npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

the-recurring-dates

v1.0.9

Published

Vanilla JS and React hook for generating recurring dates

Readme

the-recurring-dates

This package provides:

  • ✅ A vanilla JS function getRecurringDates
  • ⚛️ A React hook useRecurringDates

Supports flexible recurring patterns like daily, weekly, monthly, and yearly.


Tags: nodejs, npm-package, utility, javascript, open-source


📦 Install

npm install the-recurring-dates

📦 Module Formats

This package supports both ES Modules and UMD formats:

ES Modules (Recommended)

// Modern bundlers (Webpack, Vite, Rollup, etc.)
import {
  generateRecurringDates,
  useRecurringDates,
  getRecurringDates,
} from "the-recurring-dates";

UMD (Universal Module Definition)

// Browser (via CDN) or older bundlers
<script src="https://cdn.jsdelivr.net/npm/the-recurring-dates/dist/index.umd.js"></script>
<script>
  const { generateRecurringDates, useRecurringDates, getRecurringDates } = TheRecurringDates;
</script>

Direct Import (ES Modules)

// Direct import from specific format
import { generateRecurringDates } from "the-recurring-dates/dist/index.es.js";

📁 Available Files

| File | Format | Use Case | | ----------------------- | ---------- | ----------------------------- | | dist/index.es.js | ES Module | Modern bundlers, tree-shaking | | dist/index.umd.js | UMD | Browser CDN, older bundlers | | dist/index.es.js.map | Source Map | Debugging ES module | | dist/index.umd.js.map | Source Map | Debugging UMD |

🔧 Build Tools Integration

Webpack/Vite/Rollup (ES Modules):

import { generateRecurringDates } from "the-recurring-dates";

Browserify (UMD):

const { generateRecurringDates } = require("the-recurring-dates");

Parcel (Auto-detection):

import { generateRecurringDates } from "the-recurring-dates";

🌐 Browser Compatibility

| Format | Browser Support | Use Case | | ---------- | ------------------------- | ------------------------- | | ES Modules | Modern browsers (ES2015+) | Modern web apps, bundlers | | UMD | All browsers (ES5+) | Legacy support, CDN usage |

📦 Bundle Size

  • ES Module: ~45KB (gzipped: ~15KB)
  • UMD: ~50KB (gzipped: ~17KB)

Note: Bundle size includes moment.js dependency


🔧 Troubleshooting

Common Issues

1. Import/Export Errors

// ❌ Wrong - old format
import { generateRecurringDates } from "the-recurring-dates/dist/index.js";

// ✅ Correct - new format
import { generateRecurringDates } from "the-recurring-dates";

2. CDN Usage

// ❌ Wrong - old CDN path
<script src="https://cdn.jsdelivr.net/npm/the-recurring-dates/dist/index.js"></script>

// ✅ Correct - new CDN path
<script src="https://cdn.jsdelivr.net/npm/the-recurring-dates/dist/index.umd.js"></script>

3. React Hook in UMD

// ❌ Wrong - React hook doesn't work in UMD
const { useRecurringDates } = TheRecurringDates;

// ✅ Correct - Use ES modules for React
import { useRecurringDates } from "the-recurring-dates";

⚙️ Configuration Options

| Option | Type | Description | | --------------- | ---------- | ------------------------------------------------------------------------------- | | STARTS_ON | string | Start date of the recurrence (DD-MM-YYYY) | | ENDS_ON | string | End date of the recurrence (DD-MM-YYYY) | | FREQUENCY | string | Recurrence type: "D" (daily), "W" (weekly), "M" (monthly), "Y" (yearly) | | INTERVAL | number | Every X units of the frequency (e.g., every 2 weeks) | | MONTH_DATES | number[] | Dates of the month to include (for monthly/yearly) | | WEEK_DAYS | string[] | Days of the week: "MON", "TUE", "WED", etc. | | WEEK_ORDINALS | string[] | Week ordinals: "FIRST", "SECOND", "THIRD", "FOURTH", "LAST" | | EXCLUDE_DATES | string[] | Dates to exclude from the result | | FORMAT | string | Input Date format |


🚀 Usage

⚛️ React Hook

import { useRecurringDates } from "the-recurring-dates";

function MyComponent() {
  const dates = useRecurringDates({
    STARTS_ON: "01-06-2025",
    ENDS_ON: "31-06-2025",
    FREQUENCY: "M",
    INTERVAL: 1,
    MONTH_DATES: [1, 15],
    EXCLUDE_DATES: ["15-08-2025"],
  });

  return (
    <ul>
      {dates.map((date, i) => (
        <li key={i}>{date}</li>
      ))}
    </ul>
  );
}

🌐 Use via CDN (UMD)

<script src="https://cdn.jsdelivr.net/npm/the-recurring-dates/dist/index.umd.js"></script>
<script>
  const { generateRecurringDates, useRecurringDates, getRecurringDates } =
    TheRecurringDates;

  const dates = getRecurringDates({
    STARTS_ON: "01-06-2025",
    ENDS_ON: "31-06-2025",
    FREQUENCY: "M",
    MONTH_DATES: [1, 15],
  });

  console.log(dates);
</script>

📦 ES Modules via CDN

<script type="module">
  import { generateRecurringDates } from "https://cdn.jsdelivr.net/npm/the-recurring-dates/dist/index.es.js";

  const dates = generateRecurringDates({
    STARTS_ON: "01-06-2025",
    ENDS_ON: "31-06-2025",
    FREQUENCY: "M",
    MONTH_DATES: [1, 15],
  });

  console.log(dates);
</script>

🤝 Contributing

We welcome contributions to the-recurring-dates! Here's how you can help:

🐛 Bug Reports

If you find a bug, please create an issue with:

  • A clear description of the problem
  • Steps to reproduce
  • Expected vs actual behavior
  • Your environment details

💡 Feature Requests

We love new ideas! For feature requests:

  • Explain the feature and its use case
  • Describe any alternatives you've considered
  • Include any relevant examples

🛠️ Development

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests (npm test)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

📝 Code Style

  • Follow the existing code style
  • Write clear commit messages
  • Add tests for new features
  • Update documentation as needed

🧪 Testing

Before submitting a PR:

  • Run all tests (npm test)
  • Ensure code coverage is maintained
  • Test in different environments if applicable

📘 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Links

portfolio linkedin twitter

📦 NPM Stats

npm version npm downloads npm license