mirror of
https://github.com/quantum5/qcal.git
synced 2025-07-26 19:34:10 -04:00
jcal: use jdnWeekDay instead of ad hoc logic
This commit is contained in:
parent
4381415fa0
commit
d0ddad26c5
|
@ -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 <div className={`Day NormalDay ${jdn === todayJDN ? 'Day-today' : ''}`}>
|
||||
<div className="Day-name">{day}</div>
|
||||
<div className="Day-weekday">{weekdayNames[(jdn + 1) % 7]}</div>
|
||||
<div className="Day-weekday">{weekdayNames[jdnWeekDay(jdn)]}</div>
|
||||
<DayDetail jdn={jdn}/>
|
||||
</div>;
|
||||
}
|
||||
|
@ -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) => <WeekdayName key={i} name={name}/>);
|
||||
const firstJDN = julianJDN(year, month, 1);
|
||||
const firstWeekday = (firstJDN % 7 + 8) % 7;
|
||||
const firstWeekday = jdnWeekDay(firstJDN);
|
||||
const daysTotal = julianMonthDays(year, month);
|
||||
return <div className="Month">
|
||||
<div className="Month-weekdayHead">{decadeHeads}</div>
|
||||
|
|
Loading…
Reference in a new issue