From 99e17d1e9cf57234fb1df71c6b18bbff6f0b6182 Mon Sep 17 00:00:00 2001 From: Daniel Tsvetkov Date: Sun, 26 Apr 2020 16:51:52 +0200 Subject: [PATCH] default func parse --- tww/tww.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tww/tww.py b/tww/tww.py index 4bee5c5..5bd9e03 100644 --- a/tww/tww.py +++ b/tww/tww.py @@ -38,6 +38,12 @@ DEFAULT_FORMAT = '%Y-%m-%d %H:%M:%S%z' basepath = os.path.dirname(os.path.abspath(__file__)) +def parse_to_iso(dt): + parsed_dt = dateparser.parse(dt) + if parsed_dt: + return parsed_dt.strftime(ISO_FORMAT) + + class Location(object): """ Represents a location with name, latitude and longitude