xsoh/moment-hijri

Inconsistency when parsing month

alexfauquette opened this issue · 5 comments

I'm working on adapting the moment-hijri for mui date pickers, but I'm facing an issue when parsing months. the value is neither correctly recognized.

I made a codesandbox where I test if the function x => format(parse(format(x))) is the identity. But it's not the case.

With strict parsing, it's an invalid date and with loose parsing, it always returns 12

https://codesandbox.io/s/cranky-shadow-u3sv6g?file=/demo.tsx

Not sure if it's a bug or I'm using the library in a wrong way

hey there,

Fixed the issue. Here's an updated sandbox code

https://codesandbox.io/s/hungry-joji-3y7gm5?file=/demo.tsx

**There is still an issue of month name doesn't correspond to actual month after parsing (woking on it).

The array month naming in moment-hejri starts counting from 1, while in moment starts from 0

all issues fixed.

https://codesandbox.io/s/hungry-joji-3y7gm5?file=/demo.tsx

Thanks

We will start again the migration of the adapter

there was an issue with moment-hijri when used with @inertiajs/react

TypeError: moment.localeData is not a function

fixed it
https://github.com/anon-phantom/hijri