Time.Timem (etl_core v0.1.55)

It expands functionalities that Timex library does not present

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

Functions

Link to this function

by_intervals(start_date, end_date, step)

Given a date range, construct consecutive non-overlapping intervals

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:

- {: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:

- String
Link to this function

get_time_with_string_format()

Returns the current date in HH:MM:SS format

Return:

- String
Link to this function

is_holiday?(date)

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

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:

- 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:

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