Conditions | 1 |
Total Lines | 16 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | from datetime import datetime |
||
7 | def default_datetime_serializer(obj: datetime, |
||
8 | *, |
||
9 | strip_microseconds: Optional[bool] = False, |
||
10 | **kwargs) -> str: |
||
11 | """ |
||
12 | Serialize the given datetime instance to a string. It uses the RFC3339 |
||
13 | pattern. If datetime is a localtime, an offset is provided. If datetime is |
||
14 | in UTC, the result is suffixed with a 'Z'. |
||
15 | :param obj: the datetime instance that is to be serialized. |
||
16 | :param strip_microseconds: determines whether microseconds should be |
||
17 | omitted. |
||
18 | :param kwargs: not used. |
||
19 | :return: ``datetime`` as an RFC3339 string. |
||
20 | """ |
||
21 | return to_str(obj, strip_microseconds, kwargs['fork_inst'], |
||
22 | RFC3339_DATETIME_PATTERN) |
||
23 |