Skip to main content

Module dates

Module dates 

Source

Functionsยง

date
Formats the given value using the given format if it can be parsed as a date/datetime. Takes:
is_after
Tests whether a date is after another date. Errors if one of the values cannot be parsed as a date. Takes an optional inclusive argument defaulting to false to make this test be >= instead of >.
is_before
Tests whether a date is before another date. Errors if one of the values cannot be parsed as a date. Takes an optional inclusive argument defaulting to false to make this test be <= instead of <.
now
Returns the current datetime. You can pass an optional timezone name. Defaults to UTC if not provided.