According to the ummul-qura site, 30-Shawwal-1400 is a valid date , but it is returned as invalid when passed throught isValid function using moment-hijri plugin
moment('1400-10-30', 'iYYYY-iMM-iDD').isValid()
, What could be the issue?
https://www.ummulqura.org.sa/yearcalender.aspx?y=1400&l=True

UPDATE
Using this code in
moment-hijri.jsright after the closing brackets at line 121, dates seems to work correctly. By the way, you should check it deeply to be sure that everything is ok.(Otherwise, you can also decrease constants from 0 to 537 by 1, it's the same solution.)
If a month has 29 or 30 days depends on a simple calculation:
ummalquraData[i] - ummalquraData[i - 1]. In your case,ummalquraData[538] - ummalquraData[537]returns 29 instead of expected 30. To obtain 30 preserving every other calculation you need to increase every constant after 538 (included) OR decrease every constant before 538 (excluded). This way, you're changing only the duration of 1400-10, keeping original duration of every other month.UPDATE (not valid solution)
I have found a (seems to be) valid solution for you. Using constant data from here (https://github.com/talomaireeni/Umm-Al-Qura-Calendar/blob/master/UQCal.js), i see that
1400-10is correctly validated.Be careful, this library starts from
15141(line 17) whilemoment-hijristarts from28607(line 39). Switchingmoment-hijriconstants with the ones from this library, everything seems to work.I suggest you to open an issue in the official
moment-hijri's GitHub repository and ask for a fix.Meanwhile, you can use
UQCal.js's constants to fix your app.UPDATE (old)
Analyzing the library's source code, i found that the main problem is generated by this function (which bases its calculations on constants):
This function returns the number of days in a month providing specific
yearandmonthvalues. Providing1400and10it returns29days (instead of expected30).getNewMoonMJDNIndex()finds the index of the new moon in modified Julian day number (moment-hijri.jsat line 935) inummalquraData, which contains constant data.So, the problem is caused by wrong constant data inside
ummalquraDatawhich consider1400-10of 29 days.Here are my tests:
OLD ANSWER
Accordingly to multiple online Hijri calendars, 1400-10-30 is not a valid date:
https://www.mumineencalendar.com/# If you set 1400 Shawwal and click on '30', you'll see that '30' is referred to Gregorian Calendar - 30 August 1980 - and the "real" last day of Shawwal is 29.
This is a bit strange, every month seems to leak the last day, anyway it confirms that 1400-10-30 is not a valid date: https://www.islamicfinder.org/islamic-calendar/1400/Shawwal/?type=Hijri
So, the
isValid()method seems to work correctly.