Nonvoluntary Professional Mangling
Have ideas to improve npm?Join in the discussion! »

jalali-moment-pro-packTypeScript icon, indicating that this package has built-in type declarations

3.3.4 • Public • Published

Jalali Moment

Display, parse, manipulate and validate jalali (Persian, Khorshidi, Shamsi) or Gregorian (Miladi) dates and times and also convert Jalali (Persian, Khorshidi, Shamsi) date to Gregorian (Miladi) or vice versa in javascript or typescript. DEMO

Read this in فارسی

MIT License Build Status NPM version Package Quality dependencies Quality dev dependencies Quality Codacy Badge Codacy Badge

How to

Usage

  • Parse
    // parse gregorian date
    = moment('1989/1/24', 'YYYY/M/D');// parse a gregorian (miladi) date
    = moment.from('01/1989/24', 'en', 'MM/YYYY/DD');
     
    // parse jalali date
    = moment('1367/11/04', 'jYYYY/jMM/jDD');
    = moment.from('1367/04/11', 'fa', 'YYYY/MM/DD');
    = moment.from('04/1367/11', 'fa', 'DD/YYYY/MM');
  • Display
    m.format('jYYYY/jMM/jDD'); // 1367/11/04
    m.locale('fa').format('YYYY/MM/DD'); // 1367/11/04
  • Manipulate
    m.add(1, 'day').locale('fa').format('YYYY/MM/DD'); // 1367/11/05
  • Validate
    m.isSame(m.clone()); // true
  • Convert
    moment.from('1367/11/04', 'fa', 'YYYY/MM/DD').format('YYYY/MM/DD'); // 1989/01/24
    moment('1989/01/24', 'YYYY/MM/DD').locale('fa').format('YYYY/MM/DD'); // 1367/11/04

Install

npm i jalali-moment-pro-pack

DownloadsWeekly Downloads

1

Version

3.3.4

License

MIT

Unpacked Size

1.31 MB

Total Files

15

Last publish

Collaborators

  • avatar