jcal: fix missing first week on negative JDN months

This commit is contained in:
Quantum 2025-06-20 19:43:06 -04:00
parent fcecc7ae1a
commit eb4a7253f1

View file

@ -54,7 +54,7 @@ function Day({year, month, day, todayJDN}: DateProps & { todayJDN: number }): JS
function Month({year, month, todayJDN}: MonthProps & { todayJDN: number }): JSX.Element { function Month({year, month, todayJDN}: MonthProps & { todayJDN: number }): JSX.Element {
const decadeHeads = weekdayNames.map((name, i) => <WeekdayName key={i} name={name}/>); const decadeHeads = weekdayNames.map((name, i) => <WeekdayName key={i} name={name}/>);
const firstJDN = julianJDN(year, month, 1); const firstJDN = julianJDN(year, month, 1);
const firstWeekday = (firstJDN + 1) % 7; const firstWeekday = (firstJDN % 8 + 8) % 7;
const daysTotal = julianMonthDays(year, month); const daysTotal = julianMonthDays(year, month);
return <div className="Month"> return <div className="Month">
<div className="Month-weekdayHead">{decadeHeads}</div> <div className="Month-weekdayHead">{decadeHeads}</div>