Repository: model-bakers/model_bakery

Issue:
seq doesn't work for timezone aware datetime objects
## Expected behavior

I expect to get a generator of datetimes.

## Actual behavior

I got an exception.

## Reproduction Steps

```pycon
>>> from model_bakery.recipe import seq
>>> from datetime import datetime, timedelta, timezone
>>> dt = datetime(2022, 1, 1, tzinfo=timezone.utc)
>>> x = seq(dt, increment_by=timedelta(minutes=1))
>>> next(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/venv/lib/python3.10/site-packages/model_bakery/utils.py", line 85, in seq
    start = (date - datetime.datetime(1970, 1, 1)).total_seconds()
TypeError: can't subtract offset-naive and offset-aware datetimes
```

### Versions

Python: 3.10
Django: 4.0.5
Model Bakery: 1.5.0


Discussion:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3313c2b..9e30a2b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
 ### Added
 
 ### Changed
+- Fixed a bug with `seq` being passed a tz-aware start value [PR #353](https://github.com/model-bakers/model_bakery/pull/353)
 
 ### Removed
 
diff --git a/model_bakery/utils.py b/model_bakery/utils.py
index 42617ec..1bae5ac 100644
--- a/model_bakery/utils.py
+++ b/model_bakery/utils.py
@@ -82,7 +82,8 @@ def seq(value, increment_by=1, start=None, suffix=None):
             date = value
 
         # convert to epoch time
-        start = (date - datetime.datetime(1970, 1, 1)).total_seconds()
+        epoch_datetime = datetime.datetime(1970, 1, 1, tzinfo=date.tzinfo)
+        start = (date - epoch_datetime).total_seconds()
         increment_by = increment_by.total_seconds()
         for n in itertools.count(increment_by, increment_by):
             series_date = tz_aware(datetime.datetime.utcfromtimestamp(start + n))


Test patch:
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 7336fc8..ed7fa50 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -146,6 +146,7 @@ class TestSeq:
         settings.USE_TZ = use_tz
         tzinfo = datetime.timezone.utc if use_tz else None
 
+        # Starting with tz-unaware (naive) datetime
         sequence = seq(
             datetime.datetime(2021, 2, 11, 15, 39, 58, 457698),
             increment_by=datetime.timedelta(hours=3),
@@ -160,6 +161,15 @@ class TestSeq:
             2021, 2, 12, 00, 39, 58, 457698
         ).replace(tzinfo=tzinfo)
 
+        # Starting with tz-aware datetime
+        sequence = seq(
+            datetime.datetime(2021, 2, 11, 15, 39, 58, 457698, tzinfo=tzinfo),
+            increment_by=datetime.timedelta(hours=3),
+        )
+        assert next(sequence) == datetime.datetime(
+            2021, 2, 11, 18, 39, 58, 457698
+        ).replace(tzinfo=tzinfo)
+
     @pytest.mark.parametrize(
         "value",
         [