Module pepper.datetime
Common utility functions for date and time handling. Please note that this is a Lua module. If you want to use it, add
require "pepper.datetime"to your script.
Functions
add_daterange_options (r) | Adds command-line options for start and end date to meta.options . |
date_range (report) | Parses the date range from the report's command-line options. |
humanrange (secs) | Returns a human-friendly description of a time range. |
Functions
- add_daterange_options (r)
-
Adds command-line options for start and end date to
meta.options
.Parameters
- r: If not null, options will be added to this table
- date_range (report)
-
Parses the date range from the report's command-line options. If an option isn't present, -1 is returned in its place.
Parameters
- report: The report. If \p null, pepper.current_report() will be used.
- humanrange (secs)
-
Returns a human-friendly description of a time range. This is a port of the Rails funtion distance_of_time_in_words.
Parameters
- secs: Time range in seconds, e.g. generated using os.difftime().