Conditions | 1 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | from datetime import timezone |
||
5 | def default_timezone_serializer(obj: timezone, **kwargs) -> dict: |
||
6 | """ |
||
7 | Serialize the given timezone instance to a dict holding the total |
||
8 | seconds. |
||
9 | :param obj: the timezone instance that is to be serialized. |
||
10 | :param kwargs: not used. |
||
11 | :return: ``timezone`` as a dict. |
||
12 | """ |
||
13 | name = obj.tzname(None) |
||
14 | offset = dump(obj.utcoffset(None), **kwargs) |
||
15 | return { |
||
16 | 'name': name, |
||
17 | 'offset': offset |
||
18 | } |
||
19 |