Skip to content

Commit

Permalink
[BUG FIX]
Browse files Browse the repository at this point in the history
- fixing timezone
  • Loading branch information
Z3ZEL committed Aug 28, 2023
1 parent 4f633fa commit b0edc85
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ sphinx_rtd_theme
sphinx-autodoc-typehints
myst-parser
m2r
shapely
shapely
pytz
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ classifiers = [
]
dependencies = [
'requests',
'shapely >= 2.0.1'
'shapely >= 2.0.1',
'pytz',
]

[project.urls]
Expand Down
7 changes: 6 additions & 1 deletion src/demarches_simpy/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@ class DateField(Field):
@property
def timestamp(self) -> int:
import datetime
return int(datetime.datetime.strptime(self.date, '%Y-%m-%d').timestamp())
import pytz

parisTz = pytz.timezone('Europe/Paris')
dt = datetime.datetime.strptime(self.date, '%Y-%m-%d')
dt = parisTz.localize(dt)
return int(dt.timestamp())


@staticmethod
Expand Down
1 change: 1 addition & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ requests
python-dotenv
numpy
shapely
pytz

0 comments on commit b0edc85

Please sign in to comment.