ds_common_placeholder_py_lib.functions.time =========================================== .. py:module:: ds_common_placeholder_py_lib.functions.time .. autoapi-nested-parse:: **File:** ``functions/time.py`` **Region:** ``ds-common-placeholder-py-lib`` Description ----------- Time functions depend only on their arguments, never on the context: the date functions compute from the time they are given, their last argument (``@{get_hour, UTC, '2026-05-03T01:30:00Z'}``, or any reference the caller's context holds), or from the current time when none is (contract ยง5). Outputs match the ``legacy`` builtins at the same instant, except ``get_current_date``, which returns an ISO string. Attributes ---------- .. autoapisummary:: ds_common_placeholder_py_lib.functions.time.NOT_GIVEN Functions --------- .. autoapisummary:: ds_common_placeholder_py_lib.functions.time.check_timezone ds_common_placeholder_py_lib.functions.time.check_language ds_common_placeholder_py_lib.functions.time.check_at ds_common_placeholder_py_lib.functions.time.get_start_last_month ds_common_placeholder_py_lib.functions.time.get_end_last_month ds_common_placeholder_py_lib.functions.time.get_start_date_last_month ds_common_placeholder_py_lib.functions.time.get_end_date_last_month ds_common_placeholder_py_lib.functions.time.get_last_month_period ds_common_placeholder_py_lib.functions.time.get_current_date ds_common_placeholder_py_lib.functions.time.get_day_of_month ds_common_placeholder_py_lib.functions.time.get_previous_day_of_month ds_common_placeholder_py_lib.functions.time.get_hour ds_common_placeholder_py_lib.functions.time.get_previous_hour ds_common_placeholder_py_lib.functions.time.get_iso_timestamp_now ds_common_placeholder_py_lib.functions.time.get_unix_timestamp_now Module Contents --------------- .. py:function:: check_timezone(name: str) -> zoneinfo.ZoneInfo Return the zone for an IANA name. :raises PlaceholderError: ``argument`` if the name is not an IANA zone. .. py:function:: check_language(name: str) -> str Return *name* if it is ``EN`` or ``NO``. :raises PlaceholderError: ``argument`` otherwise. .. py:data:: NOT_GIVEN :type: Any kept apart from any string, so ``''`` is an error, never the current time. :type: The default of ``at`` .. py:function:: check_at(value: str) -> datetime.datetime The time *value* names, an RFC 3339 timestamp. :raises PlaceholderError: ``argument`` if *value* is not an RFC 3339 timestamp with ``Z`` or an offset (``''`` included). .. py:function:: get_start_last_month(args: list[Any]) -> str First instant of last month, e.g. ``2026-04-01T00:00:00+00:00``. .. py:function:: get_end_last_month(args: list[Any]) -> str Last microsecond of last month, e.g. ``2026-04-30T23:59:59.999999+00:00``. .. py:function:: get_start_date_last_month(args: list[Any]) -> str First day of last month, e.g. ``2026-04-01``. .. py:function:: get_end_date_last_month(args: list[Any]) -> str Last day of last month, e.g. ``2026-04-30``. .. py:function:: get_last_month_period(args: list[Any]) -> str Last month as `` ``, e.g. ``April 2026``. .. py:function:: get_current_date(args: list[Any]) -> str The date, e.g. ``2026-05-03``. .. py:function:: get_day_of_month(args: list[Any]) -> int The day of month. .. py:function:: get_previous_day_of_month(args: list[Any]) -> int The day of month one day before. .. py:function:: get_hour(args: list[Any]) -> int The hour, 0-23. .. py:function:: get_previous_hour(args: list[Any]) -> int The local hour one elapsed hour before, 0-23. Across a DST change this differs from ``legacy``, which subtracted wall time. .. py:function:: get_iso_timestamp_now(args: list[Any]) -> str The current time to the second, e.g. ``2026-05-03T03:30:00+02:00``. .. py:function:: get_unix_timestamp_now(args: list[Any]) -> int The current UNIX timestamp in whole seconds.