diff libervia/backend/tools/common/date_utils.py @ 4185:c6d85c31a59f

plugin ad-hoc registration: Implement plugin to handle registration links: registration links are used in web frontend to allow registration with secret links when it's normally closed.
author Goffi <goffi@goffi.org>
date Sun, 10 Dec 2023 18:32:04 +0100
parents 4325a0f13b0f
children 0d7bb4df2343
line wrap: on
line diff
--- a/libervia/backend/tools/common/date_utils.py	Sun Dec 10 15:08:08 2023 +0100
+++ b/libervia/backend/tools/common/date_utils.py	Sun Dec 10 18:32:04 2023 +0100
@@ -86,17 +86,17 @@
                 raise e
     return calendar.timegm(dt.utctimetuple())
 
-def date_parse_ext(value, default_tz=TZ_UTC):
+def date_parse_ext(value: str, default_tz: datetime.tzinfo=TZ_UTC) -> float:
     """Extended date parse which accept relative date
 
-    @param value(unicode): date to parse, in any format supported by parser
+    @param value: date to parse, in any format supported by parser
         and with the hability to specify X days/weeks/months/years in the past or future.
         Relative date are specified either with something like `[main_date] +1 week`
         or with something like `3 days ago`, and it is case insensitive. [main_date] is
         a date parsable by parser, or empty to specify current date/time.
         "now" can also be used to specify current date/time.
-    @param default_tz(datetime.tzinfo): same as for date_parse
-    @return (int): timestamp
+    @param default_tz: same as for date_parse
+    @return: timestamp
     """
     m = RELATIVE_RE.match(value)
     if m is None: