Other
rigour.time
datetime_iso(dt)
Convert a datetime object or string to an ISO 8601 formatted string. If the input is None, it returns None. If the input is a string, it is returned as is. Otherwise, the datetime object is converted to a string in the format 'YYYY-MM-DDTHH:MM:SS'.
Source code in rigour/time.py
iso_datetime(value)
cached
Parse datetime from standardized date string. This expects an ISO 8601 formatted string, e.g. '2023-10-01T12:00:00'. Any additional characters after the seconds will be ignored. The string is converted to a datetime object with UTC timezone. This is not designed to parse all possible ISO 8601 formats, but rather a specific convention used in the context of the FollowTheMoney ecosystem.
Source code in rigour/time.py
naive_now()
utc_date()
rigour.boolean
bool_text(value)
Convert a boolean value to a string representation. If the input is None, it returns None. If the input is True, it returns 't'. If the input is False, it returns 'f'.
Source code in rigour/boolean.py
text_bool(text)
cached
Convert a string representation of a boolean value to a boolean. If the input is None or an empty string, it returns None.