Time.WorkingTime (etl_core v0.1.42)
Module oriented to the calculation of working time, according to the business
Link to this section Summary
Functions
Calculates the working time elapsed between two dates. Depending on the business, hours vary.
Link to this section Functions
Link to this function
elapsed_time(start_date, end_date, business, change_timezone \\ true)
Calculates the working time elapsed between two dates. Depending on the business, hours vary.
To add a new business and its particular hours, you must:
1. Define a module with the name of the business.
2. Implement the Time.PWorkingTimeForBusiness protocol, to define particular hours. Use the following template:
```
define Time.PWorkingTimeForBusiness, for: Atom do
def function_name(date, <business_name>) do
...
end
...
end
```
parameter
Parameter:
- start_date: Timex.DateTime or String. Start date.
- end_date: Timex.DateTime or String. End date.
- business: Atom. Business.
- change_timezone: Boolean. Indicate if you have to change the dates to the time use defined in the configuration.
return
Return:
- {:ok, integer} | {:error, string}