Skip to content
Snippets Groups Projects
Commit 35e78b3a authored by BRONES Romain's avatar BRONES Romain
Browse files

Fix the default datestop

* It always gave the now-time at the moment of import...
* By letting the argument to None, it default to now
parent 8f39791f
No related branches found
No related tags found
No related merge requests found
......@@ -134,7 +134,7 @@ class ArchiveExtractor:
self,
attribute,
dateStart,
dateStop=datetime.datetime.now(),
dateStop=None,
):
"""
Query attribute data from an archiver database, get all points between dates.
......@@ -148,9 +148,11 @@ class ArchiveExtractor:
dateStart : datetime.datetime, string
Start date for extraction. If string, it will be parsed.
dateStop : datetime.datetime, string
Stop date for extraction. If string, it will be parsed.
Default is now (datetime.datetime.now())
dateStop : datetime.datetime, string, None
Stop date for extraction.
If string, it will be parsed.
If None, it takes the current date and time.
Default is None (now).
Exceptions
----------
......@@ -170,6 +172,8 @@ class ArchiveExtractor:
# Parse date if it is string
if type(dateStart) is str:
dateStart = self.dateparse(dateStart)
if dateStop is None:
dateStop = datetime.datetime.now()
if type(dateStop) is str:
dateStop = self.dateparse(dateStop)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment