Timezone helpers for Kathikon scheduling.
Configure the application timezone with:
config :kathikon, timezone: "America/New_York"Requires a time zone database (tzdata is included as a dependency):
config :elixir, :time_zone_database, Tzdata.TimeZoneDatabaseBehaviour
:schedule_atand scheduler:atacceptDateTime(any zone) orNaiveDateTime(interpreted as wall clock in the configured timezone)- Cron expressions and presets (
@daily, etc.) match against local time :schedule_instays relative to UTC instants (duration-based)- All persisted timestamps remain UTC
Summary
Functions
Returns the configured IANA timezone name.
Returns the current time in the configured timezone.
Normalizes insert/schedule options, converting :schedule_at to UTC.
Normalizes a schedule target to UTC for storage and comparison.
Converts a UTC DateTime to the configured timezone.
Converts a wall-clock time in the configured timezone to UTC.
Returns the current UTC instant.
Functions
@spec configured() :: String.t()
Returns the configured IANA timezone name.
@spec local_now() :: DateTime.t()
Returns the current time in the configured timezone.
Normalizes insert/schedule options, converting :schedule_at to UTC.
@spec normalize_schedule_at(NaiveDateTime.t() | DateTime.t()) :: {:ok, DateTime.t()} | {:error, term()}
Normalizes a schedule target to UTC for storage and comparison.
@spec to_local(DateTime.t()) :: DateTime.t()
Converts a UTC DateTime to the configured timezone.
@spec to_utc(NaiveDateTime.t() | DateTime.t()) :: {:ok, DateTime.t()} | {:error, term()}
Converts a wall-clock time in the configured timezone to UTC.
Accepts NaiveDateTime or DateTime (shifted to UTC).
@spec utc_now() :: DateTime.t()
Returns the current UTC instant.