default is not utc
This commit is contained in:
parent
95555d9600
commit
ea18b83628
@ -80,10 +80,6 @@ def handler_generic_parser(dt_s: str) -> datetime:
|
|||||||
return query_to_format_result(dt_s, None)
|
return query_to_format_result(dt_s, None)
|
||||||
|
|
||||||
|
|
||||||
def handler_dateparser(dt_s: str) -> datetime:
|
|
||||||
return dateparser_parse_dt(dt_s)
|
|
||||||
|
|
||||||
|
|
||||||
def handler_time_in_parser(dt_s: str) -> datetime:
|
def handler_time_in_parser(dt_s: str) -> datetime:
|
||||||
return query_to_format_result("now to {}".format(dt_s), None)
|
return query_to_format_result("now to {}".format(dt_s), None)
|
||||||
|
|
||||||
@ -113,7 +109,6 @@ regex_handlers = [
|
|||||||
(r_time_in, handler_time_in_parser, QUERY_TYPE_DT),
|
(r_time_in, handler_time_in_parser, QUERY_TYPE_DT),
|
||||||
(r_timezone, handler_timezone, QUERY_TYPE_TZ),
|
(r_timezone, handler_timezone, QUERY_TYPE_TZ),
|
||||||
(r_timezone_2, handler_timezone, QUERY_TYPE_TZ),
|
(r_timezone_2, handler_timezone, QUERY_TYPE_TZ),
|
||||||
(r_generic, handler_dateparser, QUERY_TYPE_DT),
|
|
||||||
(r_generic, handler_generic_parser, QUERY_TYPE_DT),
|
(r_generic, handler_generic_parser, QUERY_TYPE_DT),
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -421,10 +416,9 @@ def resolve_query(query):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
query = ""
|
query = ' '.join(sys.argv[1:])
|
||||||
custom_locale = "български език"
|
# query = "now in india"
|
||||||
# custom_locale = ""
|
custom_locale = ""
|
||||||
custom_locale = resolve_locale(custom_locale)
|
custom_locale = resolve_locale(custom_locale)
|
||||||
# query = ' '.join(sys.argv[1:])
|
|
||||||
result = resolve_query(query)
|
result = resolve_query(query)
|
||||||
pretty_print_dict(result)
|
pretty_print_dict(result)
|
||||||
|
@ -480,7 +480,7 @@ def dateparser_parse_dt(s: str):
|
|||||||
if not parsed:
|
if not parsed:
|
||||||
return None
|
return None
|
||||||
if parsed.tzinfo is None:
|
if parsed.tzinfo is None:
|
||||||
parsed = parsed.replace(tzinfo=pytz.timezone("utc"))
|
parsed = parsed.replace(tzinfo=tzinfo_from_offset(get_local_tz_offset())[0])
|
||||||
return parsed
|
return parsed
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user