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

Why it doesn't support dates before 1356(1937)?

Open unknown-exception opened this issue 7 years ago • 6 comments

m = moment('1355/8/28', 'iYYYY/iM/iD'); // Parse a Hijri date. m.format('iYYYY/iM/iD [is] YYYY/M/D'); // 1410/8/28 is 1990/3/25

"1355/12/NaN is 1001/3/1"

unknown-exception avatar Mar 15 '17 09:03 unknown-exception

so , i have this problem . anybody else have a solution ?

muhshahabipour avatar Apr 15 '17 10:04 muhshahabipour

the Ummulqura algorithm doesn't includes the days before 1355AH. AFAK that if you are targeting days before 1355 is to use the Kuwaiti hijri calculation algorithm.

xsoh avatar Apr 15 '17 17:04 xsoh

thanks for answer

i test now date but give wrong response

m = moment('1438/1/3', 'iYYYY/iM/iD'); m.format('iYYYY/iM/iD [is] YYYY/M/D'); "1355/12/NaN is 0000/1/1"

123

muhshahabipour avatar Apr 15 '17 18:04 muhshahabipour

i change code

line 587 - 590

to


input = config._i  + '-' + leftZeroFill(date[0], 4) + '-' +
					leftZeroFill(date[1] + 1, 2) + '-' +
					leftZeroFill(date[2], 2)

worked me. maybay other function are damaged (not test)

muhshahabipour avatar Apr 15 '17 19:04 muhshahabipour

hi, first thanks for the library. It is great :) Is there a way to use the Kuwaiti hijri calculation algorithm as part of this library? (I am looking for support for earlier dates)

shaharvaldman avatar May 02 '21 14:05 shaharvaldman

same issue

lakshan28 avatar Aug 17 '21 13:08 lakshan28