moment-hijri icon indicating copy to clipboard operation
moment-hijri copied to clipboard

Inconsistency when parsing month

Open alexfauquette opened this issue 2 years ago • 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

alexfauquette avatar Nov 04 '22 16:11 alexfauquette

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).

anon-phantom avatar Jul 05 '23 11:07 anon-phantom

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

anon-phantom avatar Jul 05 '23 13:07 anon-phantom

Thanks

We will start again the migration of the adapter

alexfauquette avatar Jul 05 '23 14:07 alexfauquette

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

anon-phantom avatar Jul 07 '23 07:07 anon-phantom

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

@anon-phantom the link is broken it's redirect me to 404 page

mahmoudelgamal avatar May 26 '24 11:05 mahmoudelgamal