CodeNameRaven. Timezone
(raven_observer_display_sdk v0.2.0)
Copy Markdown
A robust, enterprise-grade timezone utility for Code Name Raven.
Utilizes the official IANA Time Zone Database (Tzdb) via the tz package
to natively, safely, and dynamically shift UTC DateTime structs to any
target timezone (such as "America/Chicago") on-the-fly, handling all
Daylight Saving Time transitions flawlessly.
Summary
Functions
Shifts a UTC DateTime and returns it as a fake UTC ISO-8601 string representing the target timezone, so that client-side Plotly.js can parse it as a native Date and apply downsampling.
Formats a UTC DateTime based on the display timezone requested by the integration module. Defaults to UTC if no timezone is supplied or supported.
Natively shifts a UTC DateTime to the target IANA timezone.
Returns {:ok, shifted_datetime, zone_abbreviation}.
Functions
@spec format_chart_time(DateTime.t(), module() | nil) :: String.t()
Shifts a UTC DateTime and returns it as a fake UTC ISO-8601 string representing the target timezone, so that client-side Plotly.js can parse it as a native Date and apply downsampling.
@spec format_datetime(DateTime.t() | nil, module() | nil) :: String.t()
Formats a UTC DateTime based on the display timezone requested by the integration module. Defaults to UTC if no timezone is supplied or supported.
@spec shift_timezone(DateTime.t(), String.t()) :: {:ok, DateTime.t(), String.t()} | {:error, any()}
Natively shifts a UTC DateTime to the target IANA timezone.
Returns {:ok, shifted_datetime, zone_abbreviation}.