Constructor
new module:br/parsing/DateParser()
- Implements:
- Deprecated:
- The functionality provided by this parser can be achieved more reliably with
module:br/parsing/LocalisedDateParser
- The functionality provided by this parser can be achieved more reliably with
- Source:
Methods
-
parse(vValue, mAttributes) → {string}
-
Matches a date string and converts it to a specified output format. In order to match the date, either a list of explicit
inputFormatscan be supplied, or anamericanindicator can be used against a set of standard formats, which are as follows: American: m-d-Y, m-d-y, M-d-Y, M-d-y, m-d
European: d-m-Y, d-m-Y, d-M-Y, d-M-Y, d-m
Parameters:
Name Type Description vValuestring | Date the date to parse. mAttributesobject the map of attributes. Properties
Name Type Attributes Default Description americanboolean <optional>
false if true, dates are assumed to be in American format, i.e. month before date separatorsstring <optional>
'/.-' a set of admissible separator characters inputFormatsstring a comma separated list of admissible input formats outputFormatstring the output date format endOfUnitboolean <optional>
false if true, parse ambiguous dates to the end of the month or year - Implements:
- Source:
Returns:
the date, expressed in the output format- Type
- string