Skip to content

gramsco/dooljs

Repository files navigation

Dool.js

Edit intelligent-dew-g5dr3

Dool.js is a package inspired by dayjs that allows you to generate the list of days between two dates.

Why?

Well, because I needed to schedule things easily, comrade, that's why!

Ok, but why "dool" ?

Dr. Drake Ramoray, of course

And how does it work?

ya know the drill:

$ npm i dooljs 

and then:

const{ dool }=require("dooljs");constday1="2013-04-08";constday2=newDate();// today, 2021-01-30constdays=dool(day1,day2);console.log(days.length);// 2855

You can look for a specific day of the week :

const{ dool }=require("dooljs");constday1="1972-01-30";constday2=newDate();// today, 2021-01-30constsundays=dool(day1,day2,"sunday");console.log(sundays);/*[ 1972-01-29T23:00:00.000Z,  1972-02-05T23:00:00.000Z,  1972-02-12T23:00:00.000Z, ...]*/console.log(sundays.length);// 2557

You can also pass an array of week days:

const{ dool }=require("dooljs");constday1="1990-02-16";constday2=newDate();// today, 2021-01-30constweeknds=dool(day1,day2,["saturday","sunday"]);console.log(weeknds.length);// => 3231 saturdays and sundays (today was a saturday, hence the odd number :D)

🤖 Enjoy 🤖

About

generate a list of days between two dates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published