|
|
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs"; |
|
|
import {mod as $2b4dce13dd5a17fa$export$842a2cf37af977e1} from "./utils.mjs"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const $7c5f6fbf42389787$var$HEBREW_EPOCH = 347997; |
|
|
|
|
|
|
|
|
const $7c5f6fbf42389787$var$HOUR_PARTS = 1080; |
|
|
const $7c5f6fbf42389787$var$DAY_PARTS = 24 * $7c5f6fbf42389787$var$HOUR_PARTS; |
|
|
|
|
|
|
|
|
|
|
|
const $7c5f6fbf42389787$var$MONTH_DAYS = 29; |
|
|
const $7c5f6fbf42389787$var$MONTH_FRACT = 12 * $7c5f6fbf42389787$var$HOUR_PARTS + 793; |
|
|
const $7c5f6fbf42389787$var$MONTH_PARTS = $7c5f6fbf42389787$var$MONTH_DAYS * $7c5f6fbf42389787$var$DAY_PARTS + $7c5f6fbf42389787$var$MONTH_FRACT; |
|
|
function $7c5f6fbf42389787$var$isLeapYear(year) { |
|
|
return (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(year * 7 + 1, 19) < 7; |
|
|
} |
|
|
|
|
|
|
|
|
function $7c5f6fbf42389787$var$hebrewDelay1(year) { |
|
|
let months = Math.floor((235 * year - 234) / 19); |
|
|
let parts = 12084 + 13753 * months; |
|
|
let day = months * 29 + Math.floor(parts / 25920); |
|
|
if ((0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(3 * (day + 1), 7) < 3) day += 1; |
|
|
return day; |
|
|
} |
|
|
|
|
|
function $7c5f6fbf42389787$var$hebrewDelay2(year) { |
|
|
let last = $7c5f6fbf42389787$var$hebrewDelay1(year - 1); |
|
|
let present = $7c5f6fbf42389787$var$hebrewDelay1(year); |
|
|
let next = $7c5f6fbf42389787$var$hebrewDelay1(year + 1); |
|
|
if (next - present === 356) return 2; |
|
|
if (present - last === 382) return 1; |
|
|
return 0; |
|
|
} |
|
|
function $7c5f6fbf42389787$var$startOfYear(year) { |
|
|
return $7c5f6fbf42389787$var$hebrewDelay1(year) + $7c5f6fbf42389787$var$hebrewDelay2(year); |
|
|
} |
|
|
function $7c5f6fbf42389787$var$getDaysInYear(year) { |
|
|
return $7c5f6fbf42389787$var$startOfYear(year + 1) - $7c5f6fbf42389787$var$startOfYear(year); |
|
|
} |
|
|
function $7c5f6fbf42389787$var$getYearType(year) { |
|
|
let yearLength = $7c5f6fbf42389787$var$getDaysInYear(year); |
|
|
if (yearLength > 380) yearLength -= 30; |
|
|
switch(yearLength){ |
|
|
case 353: |
|
|
return 0; |
|
|
case 354: |
|
|
return 1; |
|
|
case 355: |
|
|
return 2; |
|
|
} |
|
|
} |
|
|
function $7c5f6fbf42389787$var$getDaysInMonth(year, month) { |
|
|
|
|
|
if (month >= 6 && !$7c5f6fbf42389787$var$isLeapYear(year)) month++; |
|
|
|
|
|
if (month === 4 || month === 7 || month === 9 || month === 11 || month === 13) return 29; |
|
|
let yearType = $7c5f6fbf42389787$var$getYearType(year); |
|
|
|
|
|
if (month === 2) return yearType === 2 ? 30 : 29; |
|
|
|
|
|
if (month === 3) return yearType === 0 ? 29 : 30; |
|
|
|
|
|
if (month === 6) return $7c5f6fbf42389787$var$isLeapYear(year) ? 30 : 0; |
|
|
return 30; |
|
|
} |
|
|
class $7c5f6fbf42389787$export$ca405048b8fb5af { |
|
|
fromJulianDay(jd) { |
|
|
let d = jd - $7c5f6fbf42389787$var$HEBREW_EPOCH; |
|
|
let m = d * $7c5f6fbf42389787$var$DAY_PARTS / $7c5f6fbf42389787$var$MONTH_PARTS; |
|
|
let year = Math.floor((19 * m + 234) / 235) + 1; |
|
|
let ys = $7c5f6fbf42389787$var$startOfYear(year); |
|
|
let dayOfYear = Math.floor(d - ys); |
|
|
|
|
|
while(dayOfYear < 1){ |
|
|
year--; |
|
|
ys = $7c5f6fbf42389787$var$startOfYear(year); |
|
|
dayOfYear = Math.floor(d - ys); |
|
|
} |
|
|
|
|
|
let month = 1; |
|
|
let monthStart = 0; |
|
|
while(monthStart < dayOfYear){ |
|
|
monthStart += $7c5f6fbf42389787$var$getDaysInMonth(year, month); |
|
|
month++; |
|
|
} |
|
|
month--; |
|
|
monthStart -= $7c5f6fbf42389787$var$getDaysInMonth(year, month); |
|
|
let day = dayOfYear - monthStart; |
|
|
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, year, month, day); |
|
|
} |
|
|
toJulianDay(date) { |
|
|
let jd = $7c5f6fbf42389787$var$startOfYear(date.year); |
|
|
for(let month = 1; month < date.month; month++)jd += $7c5f6fbf42389787$var$getDaysInMonth(date.year, month); |
|
|
return jd + date.day + $7c5f6fbf42389787$var$HEBREW_EPOCH; |
|
|
} |
|
|
getDaysInMonth(date) { |
|
|
return $7c5f6fbf42389787$var$getDaysInMonth(date.year, date.month); |
|
|
} |
|
|
getMonthsInYear(date) { |
|
|
return $7c5f6fbf42389787$var$isLeapYear(date.year) ? 13 : 12; |
|
|
} |
|
|
getDaysInYear(date) { |
|
|
return $7c5f6fbf42389787$var$getDaysInYear(date.year); |
|
|
} |
|
|
getYearsInEra() { |
|
|
|
|
|
return 9999; |
|
|
} |
|
|
getEras() { |
|
|
return [ |
|
|
'AM' |
|
|
]; |
|
|
} |
|
|
balanceYearMonth(date, previousDate) { |
|
|
|
|
|
if (previousDate.year !== date.year) { |
|
|
if ($7c5f6fbf42389787$var$isLeapYear(previousDate.year) && !$7c5f6fbf42389787$var$isLeapYear(date.year) && previousDate.month > 6) date.month--; |
|
|
else if (!$7c5f6fbf42389787$var$isLeapYear(previousDate.year) && $7c5f6fbf42389787$var$isLeapYear(date.year) && previousDate.month > 6) date.month++; |
|
|
} |
|
|
} |
|
|
constructor(){ |
|
|
this.identifier = 'hebrew'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export {$7c5f6fbf42389787$export$ca405048b8fb5af as HebrewCalendar}; |
|
|
|
|
|
|