diff options
Diffstat (limited to 'bvggrabber/api/__init__.py')
-rw-r--r-- | bvggrabber/api/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bvggrabber/api/__init__.py b/bvggrabber/api/__init__.py index 1e31359..2793e3c 100644 --- a/bvggrabber/api/__init__.py +++ b/bvggrabber/api/__init__.py @@ -4,6 +4,7 @@ from dateutil.parser import parse fullformat = lambda dt: dt.strftime('%Y-%m-%d %H:%M') +hourformat = lambda dt: dt.strftime('%H:%M') class QueryApi(): @@ -26,7 +27,7 @@ class Departure(): # We assume to get a UNIX / POSIX timestamp self.when = datetime.fromtimestamp(when) elif isinstance(when, str): - self.when = parse(when) + self.when = parse(when, fuzzy=True) #if (self.when - self.now).total_seconds() < -60: # self.when = self.when + timedelta(days=1) elif isinstance(when, datetime): @@ -37,7 +38,7 @@ class Departure(): def __str__(self): return "Start: %s, End: %s, when: %s, now: %s, line: %s" % ( - self.start, self.end, fullformat(self.when), fullformat(self.now), + self.start, self.end, hourformat(self.when), hourformat(self.now), self.line) @property |