Skip to content

Documentation / @jalali-js/nlp

@jalali-js/nlp ​

npm versionLicense: MITDocs

Natural language date parsing for jalali-js in English, Farsi, and Pashto.

Start here: Live demo · Documentation

npm ecosystem: jalali-js · @jalali-js/i18n · @jalali-js/nlp · @jalali-js/holidays · @jalali-js/react · @jalali-js/vue · @jalali-js/web · @jalali-js/ui-react · @jalali-js/ui-vue · @jalali-js/ui-web

Contents ​

Install ​

sh
npm install @jalali-js/nlp

Compatibility ​

ItemSupport
Localesen, fa, ps
Dependenciesjalali-js, @jalali-js/i18n
Node22 and 24 (CI matrix)

Quick start ​

ts
import { parse } from '@jalali-js/nlp';

parse('tomorrow', 'en'); // CalendarDate | null
parse('فردا', 'fa');
parse('نن', 'ps');
parse('next Farvardin', 'en');
parse('۱۵ مرداد ۱۴۰۳', 'fa');

Returns a CalendarDate, or null when the input is unclear.

API ​

ExportRole
parseParse a phrase into a CalendarDate
getWordListLocale word list used by the parser

Relative words (today, tomorrow, next week), month names, and numeric dates are covered per locale. Farsi uses Persian script. English accepts transliterated Jalali month names (Mehr, Aban).

Options ​

ts
parse(input, locale, { system?: 'jalali' | 'gregorian' });
OptionValuesDefaultNotes
locale'en' | 'fa' | 'ps'requiredWord list and digits
system'jalali' | 'gregorian''jalali'Calendar for result

Guide: NLP.

Theming ​

This package has no UI.

License ​

MIT

Interfaces ​

Type Aliases ​

Functions ​