Time.Timem (etl_core v0.1.54)

It expands functionalities that Timex library does not present

Link to this section Summary

Functions

Given a date range, construct consecutive non-overlapping intervals

Returns the current time in YYYY-MM-DDformat

Returns the current date in HH:MM:SS format

Determine given the month and day, if it is a holiday

Search the time defined in the configuration, for sending notifications

Link to this section Functions

Link to this function

by_intervals(start_date, end_date, step)

Given a date range, construct consecutive non-overlapping intervals

parameters

Parameters:

- start_date: Timex.DateTime. Interval start date.

- end_date: Timex.DateTime. End date of the interval.

-step: Integer. Number of days covered by a subinterval.

returns

Returns:

- {:error, Atom (reason)} | {:ok, [{Timex.DateTime, Timex.DateTime}, ...]}
Link to this function

get_date_with_string_format()

Returns the current time in YYYY-MM-DDformat

return

Return:

- String
Link to this function

get_time_with_string_format()

Returns the current date in HH:MM:SS format

return

Return:

- String
Link to this function

is_holiday?(date)

Determine given the month and day, if it is a holiday

parameter

Parameter:

- date: Timex.DateTime.

Return:

- boolean. True if day is a holiday, false otherwise.
Link to this function

notification_frequency(info)

Search the time defined in the configuration, for sending notifications

parameter

Parameter:

- info. Map. Information about the time. It is expected to have the format
    ```%{
        day: value_0,
        hours: value_1,
        minute: value_2,
        second: value_3,
    }
    ```
    If no time measurement is found or they are invalid, it will be taken as 0.

return

Return:

- Integer. Time in milliseconds. The smallest possible return value is 1000 (1 second).