gcal: fix missing first week on negative JDN months

This commit is contained in:
Quantum 2025-06-19 22:25:19 -04:00
parent 59fe324126
commit 88bf611c90

View file

@ -68,7 +68,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 = gregorianJDN(year, month, 1); const firstJDN = gregorianJDN(year, month, 1);
const firstWeekday = (firstJDN + 1) % 7; const firstWeekday = (firstJDN % 7 + 8) % 7;
const daysTotal = gregorianMonthDays(year, month); const daysTotal = gregorianMonthDays(year, month);
return <div className="Month"> return <div className="Month">
<div className="Month-weekdayHead">{decadeHeads}</div> <div className="Month-weekdayHead">{decadeHeads}</div>