From d0ddad26c5c18be9c24ca35b20fbeed1d56287cf Mon Sep 17 00:00:00 2001 From: Quantum Date: Thu, 3 Jul 2025 16:31:42 -0400 Subject: [PATCH] jcal: use jdnWeekDay instead of ad hoc logic --- jcal/src/Calendar.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jcal/src/Calendar.tsx b/jcal/src/Calendar.tsx index 96931db..9b820ec 100644 --- a/jcal/src/Calendar.tsx +++ b/jcal/src/Calendar.tsx @@ -1,6 +1,6 @@ import React from 'react'; import './Calendar.scss'; -import {formatJG, jdnGregorian, JulianDay, JulianMonth, monthName, weekdayNames} from '@common/gregorian'; +import {formatJG, jdnGregorian, JulianDay, JulianMonth, monthName, jdnWeekDay, weekdayNames} from '@common/gregorian'; import {jdnLongCount} from '@common/longCount'; import {jdnJulian, julianJDN, julianMonthDays} from '@common/julian'; import {frDateFormat, frEndJD, frStartJD, jdnFrench} from '@common/french'; @@ -46,7 +46,7 @@ function Day({year, month, day, todayJDN}: DateProps & { todayJDN: number }): JS const jdn = julianJDN(year, month, day); return
{day}
-
{weekdayNames[(jdn + 1) % 7]}
+
{weekdayNames[jdnWeekDay(jdn)]}
; } @@ -54,7 +54,7 @@ function Day({year, month, day, todayJDN}: DateProps & { todayJDN: number }): JS function Month({year, month, todayJDN}: MonthProps & { todayJDN: number }): JSX.Element { const decadeHeads = weekdayNames.map((name, i) => ); const firstJDN = julianJDN(year, month, 1); - const firstWeekday = (firstJDN % 7 + 8) % 7; + const firstWeekday = jdnWeekDay(firstJDN); const daysTotal = julianMonthDays(year, month); return
{decadeHeads}