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 فارسی
How to
-
Install
-
Use jalali moment in
-
Use API
This plugin provides using jalali and gregorian calendar system together
on momentjs api.
.locale('fa');
it will use jalali calendar system
.locale('any other locale');
it will use gregorian calendar system
Usage
- Parse
m = moment('1989/1/24', 'YYYY/M/D');
m = moment.from('01/1989/24', 'en', 'MM/YYYY/DD');
m = moment('1367/11/04', 'jYYYY/jMM/jDD');
m = moment.from('1367/04/11', 'fa', 'YYYY/MM/DD');
m = moment.from('04/1367/11', 'fa', 'DD/YYYY/MM');
- Display
m.format('jYYYY/jMM/jDD');
m.locale('fa').format('YYYY/MM/DD');
- Manipulate
m.add(1, 'day').locale('fa').format('YYYY/MM/DD');
- Validate
m.isSame(m.clone());
- Convert
moment.from('1367/11/04', 'fa', 'YYYY/MM/DD').format('YYYY/MM/DD');
moment('1989/01/24', 'YYYY/MM/DD').locale('fa').format('YYYY/MM/DD');