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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@doranjs/nlp

v0.1.4

Published

Persian natural-language date parsing for the Solar Hijri calendar.

Readme

@doranjs/nlp

Persian natural-language date parsing for the Solar Hijri calendar.

Turns everyday Persian expressions like فردا, جمعه ساعت ۷ شب, and دو هفته دیگر into precise DoranDate values, with a confidence score.

Install

pnpm add @doranjs/nlp @doranjs/core

Usage

import { parse } from '@doranjs/nlp';

parse('جمعه ساعت ۷ شب');
// → { date: DoranDate, confidence: 0.98, matched: 'جمعه ساعت 7 شب' }

parse('دو هفته دیگر');
parse('اول ماه بعد');
parse('بیست و یکم خرداد'); // compound number words
parse('اواخر اسفند'); // anchored months
parse('جمعه هفته بعد'); // weekday in the following week
parse('نوروز سال آینده');

It is forgiving: Finglish and text typed with the keyboard left in English still resolve.

parse('farda'); // Finglish → فردا
parse('emshab'); // → tonight
parse('tvnh'); // US-QWERTY keystrokes for «فردا» → tomorrow

Pass a reference date to resolve relative expressions deterministically:

import { DoranDate } from '@doranjs/core';

parse('فردا', { reference: DoranDate.fromJalali(1405, 1, 1) });

Supported expressions

| Category | Examples | | -------------- | ----------------------------------------------------------- | | Relative days | امروز, امشب, فردا, دیروز, دیشب, پریروز, پریشب | | Weekdays | شنبه, سه شنبه آینده, جمعه هفته بعد | | Explicit dates | ۱۵ خرداد, بیست و یکم خرداد, ۱۴۰۵/۰۳/۲۰ | | Units | دو هفته دیگر, ۳ روز پیش, سال آینده | | Month anchors | اول ماه بعد, آخر ماه, اواخر اسفند | | Special days | نوروز, نوروز سال آینده, یلدا, سیزده به در | | Time of day | ساعت ۷ شب, ساعت ۱۴:۳۰, شنبه صبح, سحر, نیمروز |

Beyond parse, the package also exports parseRange («از ۵ تا ۱۰ فروردین»), parseDuration («یک ساعت و نیم»), parseRecurrence / occurrences («هر دوشنبه», «یک روز در میان»), and suggest for autocomplete. See the full API reference.

Architecture

The parser is a small, modular pipeline:

  1. Normalization — unifies digits and Arabic glyphs, strips ZWNJ/diacritics.
  2. Day extractors — resolve the calendar day (relative, weekday, month, special).
  3. Time extractors — resolve the time of day (explicit clock or part-of-day).
  4. Composition — combine day + time and compute a confidence score.

It is fully extensible — register your own rules without forking the defaults:

import { Parser } from '@doranjs/nlp';

const parser = new Parser();
parser.useDay((ctx) => (/تعطیلات/.test(ctx.text) ? resolveHoliday(ctx) : null));
parser.parse('تعطیلات بعدی');

License

MIT