1.0.1 • Published 4 years ago

dates-query v1.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

Date-Query

Date Query is a small Javascript library for querying dates. If you have ever considered range of dates to be a mini database, then date-query will help you query them and get you results just like SQL does.

Installation

npm i dates-query --save

In Nodejs

const dq = require('dates-query') 

Without specifying any month

const a = dq.get.all('tue').in('2020')

console.log(a)
[
  '2020-01-07', '2020-01-14', '2020-01-21',
  '2020-01-28', '2020-02-04', '2020-02-11',
  '2020-02-18', '2020-02-25', ...
]

With month specific

const a = dq.get.all('tue').in('mar 2020')

console.log(a)
[ '2020-03-03', '2020-03-10', '2020-03-17', '2020-03-24' ]

Year range without specifying any month

const a = dq.get.all('tue').from('2019').to('2020')

Year range, specifying beginning month

const a = dq.get.all('tue').from('feb 2019').to('2020')

Year range, specifying ending month

const a = dq.get.all('tue').from('2019').to('mar 2020')

Year range, specifying beginning and ending months

const a = dq.get.all('tue').from('feb 2019').to('jun 2020')