2.0.5 ā€¢ Published 3 years ago

dooljs v2.0.5

Weekly downloads
56
License
ISC
Repository
github
Last release
3 years ago

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");

const day1 = "2013-04-08";
const day2 = new Date(); // today, 2021-01-30
const days = dool(day1, day2);

console.log(days.length);

// 2855

You can look for a specific day of the week :

const { dool } = require("dooljs");

const day1 = "1972-01-30";
const day2 = new Date(); // today, 2021-01-30
const sundays = 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");

const day1 = "1990-02-16";
const day2 = new Date(); // today, 2021-01-30
const weeknds = dool(day1, day2, ["saturday", "sunday"]);

console.log(weeknds.length);

// => 3231 saturdays and sundays (today was a saturday, hence the odd number :D)

šŸ¤– Enjoy šŸ¤–

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.0

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.0

3 years ago

1.2.1

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago