package
Parse a year into its full number value
npm install parse-yearGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Parse a year into its full number value
$ npm install --save parse-yearvar parseYear = require('parse-year');
parseYear('2015') // 2015
parseYear('15', true) // 2015parseYear(year, [expand], [now]) -> number / undefinedParses the year, returning undefined if the input was invalid.
Required
Type: string / number
The year input to parse.
Type: boolean
Default: false
If true, expand the year from a 1 or 2 digit number into a full year number, e.g. '15' to 2015.
Type: date
Default: new Date()
The date from which to calculate the full year. Only used when expand is true.
MIT © Ben Drucker
Estimated unpacked size across 6 packages.
10.2 kB
Includes dependencies.