
Security News
Meet Socket at Black Hat Europe and BSides London 2025
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.
dates-between
Advanced tools
Get all of the dates between two given dates, with generators.
const startDate = new Date('2016-01-01');
const endDate = new Date('2017-01-01');
for (const date of datesBetween(startDate, endDate)) {
console.log(date);
}
This library requires the following to run:
Install with npm:
npm install dates-between
Load the library into your code with a require call:
const { datesBetween } = require('dates-between');
The datesBetween function accepts two arguments, a start date and an end date. Both of these must be Date objects:
datesBetween(new Date('2016-01-01'), new Date('2016-02-01'));
This returns an iterable which can be iterated over in a for..of construct. The yielded dates include both the start and end date that were passed in.
for (const date of datesBetween(startDate, endDate)) {
console.log(date);
}
Because datesBetween returns an iterable, you can also create a Set or Array from it:
const dates = new Set(datesBetween(startDate, endDate));
const dates = Array.from(datesBetween(startDate, endDate));
Usage examples can be found in the example directory of this repository.
A new major version of this project is released if breaking changes are introduced. We maintain a migration guide to help users migrate between these versions.
The contributing guide is available here. All contributors must follow this library's code of conduct.
Licensed under the MIT license.
Copyright © 2016, Rowan Manning
FAQs
Get all of the dates between two given dates
The npm package dates-between receives a total of 485 weekly downloads. As such, dates-between popularity was classified as not popular.
We found that dates-between demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.