UEA-Prodem

This commit is contained in:
2026-06-10 12:38:42 -03:00
parent 3f33154e16
commit c41625e542
9352 changed files with 1128292 additions and 14752 deletions
+21
View File
@@ -0,0 +1,21 @@
import { toGregorianDate, toHijriDate } from "./conversion.js";
import { clampHijriDate } from "./range.js";
const MAX_DAY_IN_HIJRI_MONTH = 30;
const MIN_DAY_IN_HIJRI_MONTH = 29;
export function getDaysInMonth(year, monthIndex) {
const clamped = clampHijriDate({ year, monthIndex, day: 1 });
for (let day = MAX_DAY_IN_HIJRI_MONTH; day >= MIN_DAY_IN_HIJRI_MONTH; day -= 1) {
const candidateDate = toGregorianDate({
year: clamped.year,
monthIndex: clamped.monthIndex,
day,
});
const roundTrip = toHijriDate(candidateDate);
if (roundTrip.year === clamped.year &&
roundTrip.monthIndex === clamped.monthIndex &&
roundTrip.day === day) {
return day;
}
}
return MIN_DAY_IN_HIJRI_MONTH;
}