xsoh / moment-hijri

A Hijri calendar (Based on Umm al-Qura calculations) plugin for moment.js

Home Page:http://momentjs.com/docs/#/plugins/hijri/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parse logic doesn't match format logic

mdentremont opened this issue · comments

import * as momentHijri from 'moment-hijri'

momentHijri.locale('ar-SA')
momentHijri(momentHijri().format('iYYYY/iMM/iDD'), 'iYYYY/iMM/iDD').isValid()

Running this code returns false for me --- I would expect to be able to parse a value using the same format string used to generate it. Looking at the code, it might be because the parse logic isn't handling the Arabic numerals, ie: with my above format string, the parse would only handle '1111-11-11' format.

@mdentremont How did you fix this bug?

I have since left the company which used this code, so given the age and also that I can't test I closed it :(