mirror of
https://github.com/quantum5/qcal.git
synced 2025-07-27 03:34:11 -04:00
common: create shared jdnWeekDay function
This commit is contained in:
parent
7c302fa44e
commit
ebe627d5de
|
@ -49,6 +49,8 @@ const monthNames: { [key in JulianMonth]: string } = {
|
||||||
12: 'December',
|
12: 'December',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
||||||
|
|
||||||
export const weekdayNames = [
|
export const weekdayNames = [
|
||||||
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',
|
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',
|
||||||
];
|
];
|
||||||
|
@ -91,6 +93,10 @@ export function monthName(month: JulianMonth): string {
|
||||||
return monthNames[month];
|
return monthNames[month];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function jdnWeekDay(jdn: number): Weekday {
|
||||||
|
return (jdn % 7 + 8) % 7 as Weekday;
|
||||||
|
}
|
||||||
|
|
||||||
export function gregorianMonthDays(year: number, month: JulianMonth, julian = false): 28 | 29 | 30 | 31 {
|
export function gregorianMonthDays(year: number, month: JulianMonth, julian = false): 28 | 29 | 30 | 31 {
|
||||||
switch (month) {
|
switch (month) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
Loading…
Reference in a new issue