NAME

App::Dochazka::REST::Util::Date - module containing miscellaneous date routines

SYNOPSIS

use App::Dochazka::REST::Util::Date;

...

EXPORTS

FUNCTIONS

calculate_hours

Given a canonicalized tsrange, return the number of hours. For example, if the range is [ 2016-01-06 08:00, 2016-01-06 09:00 ), the return value will be 1. If the range is [ 2016-01-06 08:00, 2016-01-07 09:00 ), the return value will 25.

single_day_hours

Given two strings in the format HH:MM representing a starting and an ending time, calculate and return the number of hours.

canon_date_diff

Compute difference (in days) between two canonical dates

canon_to_ymd

Takes canonical date YYYY-MM-DD and returns $y, $m, $d

tsrange_to_dates_and_times

Takes a string that might be a canonicalized tsrange. Attempts to extract beginning and ending dates (YYYY-MM-DD) from it. If this succeeds, an OK status object is returned, the payload of which is a hash suitable for passing to holidays_and_weekends().

ymd_to_canon

Takes $y, $m, $d and returns canonical date YYYY-MM-DD