Exqute v0.1.3 Exqute.Schedule.CronUtils View Source

Scheduler-specific utilities

Link to this section Summary

Functions

Returns the CRON string without the timezone. If there is no timezone, it returns the whole CRON string.

Returns the tuple of the Time Zone and CRON string

Returns the time zone without the CRON string

Encode the given time to the Epoch

Removes all nil values from the specified map

Normalizes a cron expression with timezone support

Link to this section Functions

Link to this function

cron_string_without_zone(string)

View Source
cron_string_without_zone(String.t()) :: String.t()

Returns the CRON string without the timezone. If there is no timezone, it returns the whole CRON string.

iex> Exqute.Schedule.CronUtils.cron_string_without_zone("* * * * * * UTC")
"* * * * * *"
iex> Exqute.Schedule.CronUtils.cron_string_without_zone("* * * * * *")
"* * * * * *"
Link to this function

cron_zone_with_string(string)

View Source
cron_zone_with_string(String.t()) :: {String.t(), String.t()}

Returns the tuple of the Time Zone and CRON string

iex> Exqute.Schedule.CronUtils.cron_zone_with_string("* * * * * *")
{"UTC", "* * * * * *"}
iex> Exqute.Schedule.CronUtils.cron_zone_with_string("* * * * * * Asia/Kolkata")
{"Asia/Kolkata", "* * * * * *"}
Link to this function

cron_zone_without_string(string)

View Source
cron_zone_without_string(String.t()) :: String.t()

Returns the time zone without the CRON string

iex> Exqute.Schedule.CronUtils.cron_zone_without_string("* * * * * * Asia/Kolkata")
"Asia/Kolkata"
iex> Exqute.Schedule.CronUtils.cron_zone_without_string("* * * * * *")
"UTC"
Link to this function

encode_to_epoch(time)

View Source
encode_to_epoch(DateTime.t() | NaiveDateTime.t()) :: float()

Encode the given time to the Epoch

Link to this function

get_nearer_date(ref_date, date1, date2)

View Source

Get a nearer date.

Link to this function

remove_nils(map)

View Source
remove_nils(map() | any()) :: map()

Removes all nil values from the specified map

iex> Exqute.Schedule.CronUtils.remove_nils(%{})
%{}
iex> Exqute.Schedule.CronUtils.remove_nils([])
%{}
iex> Exqute.Schedule.CronUtils.remove_nils(%{foo: :bar, baz: nil})
%{foo: :bar}

Normalizes a cron expression with timezone support