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
Get a nearer date.
Removes all nil values from the specified map
Normalizes a cron expression with timezone support
Link to this section Functions
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("* * * * * *")
"* * * * * *"
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", "* * * * * *"}
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 Sourceencode_to_epoch(DateTime.t() | NaiveDateTime.t()) :: float()
Encode the given time to the Epoch
Get a nearer date.
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}
Link to this function
to_cron(string)
View Sourceto_cron(String.t()) :: {Crontab.CronExpression.t(), Timex.Duration.t()}
Normalizes a cron expression with timezone support