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

@kermank/nldp

v1.3.0

Published

A modular date/time parser for converting natural language into dates and times

Readme

🗓 Natural Language Date Parser

A modular, preference-based date/time parser that handles natural language expressions with confidence scoring and debugging capabilities.

npm version License: MIT

✨ Features

  • 📝 Parse natural language date/time expressions
  • 🌍 Timezone-aware with full DST support
  • ⚙️ Configurable preferences (week start, reference date)
  • 🎯 Confidence scoring for parse results
  • 🐛 Debug mode with detailed parse traces
  • 📦 Modular rule system for easy extension

🚀 Quick Start

import { NLDP } from 'natural-language-date-parser';

const parser = new NLDP({
    referenceDate: new Date(),
    weekStartsOn: 1, // Monday
    timeZone: 'America/New_York'
});

const result = parser.parse('next Monday at 3pm');
console.log(result);

📖 Supported Expressions

🗓 Absolute Dates

  • ISO format: "2024-03-20", "03/20/2024"
  • Month names: "January 5, 2025", "Jan 5th, 2025"
  • Day first: "5 January 2025", "5th Jan 2025"
  • Current year: "January 5", "5th Jan"

⏰ Time

  • 12-hour: "3:30 PM", "3pm"
  • 24-hour: "15:30"
  • Special times: "noon", "midnight"
  • With dates: "March 20th at 3:30 PM"

📅 Relative Days

  • Simple: "today", "tomorrow", "yesterday"
  • Extended: "day after tomorrow", "day before yesterday"
  • Offset: "3 days from now", "2 days ago"
  • Next weekday: "next Monday", "next Friday"

📊 Ordinal Days

  • Month-based: "first Monday in March", "last Friday in March"
  • Numeric: "2nd Thursday in March"
  • Month end: "last day of month", "penultimate day"
  • Position: "third to last day of month"

📦 Week Expressions

  • Simple: "this week", "next week", "last week"
  • Extended: "week after next"
  • Offset: "3 weeks from now"
  • With weekday start preference

📋 Month Parts

  • Segments: "early March", "mid March", "late March"
  • Halves: "first half of April", "second half of April"
  • Boundaries: "beginning of April", "end of March"

🎯 Fuzzy Ranges

  • Weekends: "this weekend", "next weekend"
  • Multiple: "next 2 weekends", "following 3 weekends"
  • Month parts: "first 3 days of next month", "last 5 days of March"

🔄 Combined Expressions

  • Date + Time: "tomorrow at 3pm", "next Monday at 3:30pm"
  • Relative + Time: "3 days from now at noon"
  • Ordinal + Time: "1st of April at midnight"

All expressions support:

  • 🌍 Timezone awareness
  • 📊 Confidence scoring
  • 🎯 Range or single date output
  • 🐛 Detailed debug traces

⚙️ Configuration

interface DateParsePreferences {
    referenceDate?: Date;
    weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
    timeZone?: string;
    debug?: boolean;
}

🔍 Debug Mode

Enable detailed parsing traces:

const result = parser.parse('next Monday at 3pm', { debug: true });

🧪 Testing

npm test

🤝 Contributing

Contributions are welcome! Please see the CONTRIBUTING.md for details.

📝 License

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