get-calendar-dates

1.0.0 • Public • Published

get-calendar-dates

NPM version Bower version Build Status Build status Coverage Status Dependency Status devDependency Status

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.

Package Sidebar

Install

npm i get-calendar-dates

Weekly Downloads

4

Version

1.0.0

License

none

Last publish

Collaborators

  • shinnn