|
| | __init__ (self, Union[str, None] jsonval=None) |
| |
| | __setattr__ (self, prop, value) |
| |
| | with_json (cls, Union[str, list] jsonobj) |
| | Initialize a date from an ISO date string.
|
| |
| | with_json_and_owner (cls, Union[str, list] jsonobj, owner) |
| | Added for compatibility reasons to FHIRElement; "owner" is discarded.
|
| |
| Union[str, None] | as_json (self) |
| | Returns the original JSON string used to create this instance.
|
| |
A convenience class for working with FHIR datetimes in Python.
http://hl7.org/fhir/R4/datatypes.html#datetime
Converting to a Python representation does require some compromises:
- This class will convert partial dates ("reduced precision dates") like "2024" into full naive datetimes using the earliest possible time (in this example, "2024-01-01T00:00:00") because Python's datetime class does not support partial dates.
- FHIR allows arbitrary sub-second precision, but Python only holds microseconds.
- Leap seconds (:60) will be changed to the 59th second (:59) because Python's time classes do not support leap seconds.
If such compromise is not useful for you, avoid using the date, datetime, or isostring properties and just use the as_json() method in order to work with the original, exact string.
Public properties:
datetime: datetime.datetime representing the JSON value (naive or aware)
date: backwards-compatibility alias for datetime
isostring: an ISO 8601 string version of the above Python object
Public methods:
as_json: returns the original JSON used to construct the instance