get-calendar-dates
v1.0.0
Published
Get all ISO calendar dates in a string
Downloads
6
Maintainers
Readme
get-calendar-dates
Get all ISO calendar dates in a string
getCalendarDates('2015-01-25 0101 20150126 11112233 2015-13-13');
//=> ['2015-01-25' '20150126']
Installation
Package managers
npm
npm install get-calendar-dates
bower
bower install get-calendar-dates
Duo
var getCalendarDates = require('shinnn/get-calendar-dates');
Standalone
Download the script file directly.
API
getCalendarDates(string [, options])
string: String
options: Object
Return: Array
of String
It returns an array of calender dates (YYYY-MM-DD and YYYYMMDD) included in the string.
options.basic
Type: Boolean
Default: true
false
avoids matching the basic format (YYYYMMDD).
getCalendarDates('20130413', {basic: false}); //=> []
options.extended
Type: Boolean
Default: true
false
avoids matching the extended format (YYYY-MM-DD).
getCalendarDates('2013-04-13', {basic: false}); //=> []
calendarDateRegex.noDay(string)
string: String
Return: Array
of String
It returns an array of calender dates with reduced precision (YYYY-MM) in the string.
getCalendarDates.noDay('2015-01 201501'); //=> ['2015-01']
License
Copyright (c) Shinnosuke Watanabe
Licensed under the MIT License.