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.
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')