comment here

This commit is contained in:
ton
2023-03-18 20:03:34 +07:00
commit 4553a0a589
14513 changed files with 2685043 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
from datetime import timezone
from jsons._dump_impl import dump
def default_timezone_serializer(obj: timezone, **kwargs) -> dict:
"""
Serialize the given timezone instance to a dict holding the total
seconds.
:param obj: the timezone instance that is to be serialized.
:param kwargs: not used.
:return: ``timezone`` as a dict.
"""
name = obj.tzname(None)
offset = dump(obj.utcoffset(None), **kwargs)
return {
'name': name,
'offset': offset
}