mirror of
https://github.com/quantum5/qcal.git
synced 2025-07-27 03:34:11 -04:00
Compare commits
3 commits
af113d9fe6
...
15129bdde0
Author | SHA1 | Date | |
---|---|---|---|
|
15129bdde0 | ||
|
785f89bf6c | ||
|
3cdbfd8ca0 |
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
formatHaab,
|
formatHaab,
|
||||||
formatLordOfNight,
|
formatLordOfNight,
|
||||||
formatTzolkin,
|
formatTzolkin, HaabMonth, haabMonthDays,
|
||||||
jdnHaab, jdnHaabExt,
|
jdnHaab, jdnHaabExt,
|
||||||
jdnLordOfNight,
|
jdnLordOfNight,
|
||||||
jdnTzolkin,
|
jdnTzolkin,
|
||||||
|
@ -163,6 +163,18 @@ describe('jdnHaab', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('haabMonthDays', () => {
|
||||||
|
it('returns 20 days for months 1-18', () => {
|
||||||
|
for (let month = 1; month <= 18; month++) {
|
||||||
|
expect(haabMonthDays(month as HaabMonth)).toBe(20);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns 5 days for month 19 (Wayeb)', () => {
|
||||||
|
expect(haabMonthDays(19)).toBe(5);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('jdnHaabExt', () => {
|
describe('jdnHaabExt', () => {
|
||||||
it('handles creation correctly', () => {
|
it('handles creation correctly', () => {
|
||||||
expect(jdnHaabExt(583934)).toEqual({year: -1, month: 19, day: 4}); // end of the year before creation
|
expect(jdnHaabExt(583934)).toEqual({year: -1, month: 19, day: 4}); // end of the year before creation
|
||||||
|
|
|
@ -108,8 +108,14 @@ export function jdnHaab(jdn: number): Haab {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function haabMonthDays(month: HaabMonth): number {
|
||||||
|
return month === 19 ? 5 : 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type HaabYear = number;
|
||||||
|
|
||||||
export type HaabExt = Haab & {
|
export type HaabExt = Haab & {
|
||||||
year: number,
|
year: HaabYear,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function jdnHaabExt(jdn: number): HaabExt {
|
export function jdnHaabExt(jdn: number): HaabExt {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Calendar} from './Calendar';
|
import {Calendar} from './Calendar';
|
||||||
import {FrenchMonth, frEndJD, frStartJD, frSupportedYear, jdnFrench} from '@common/french';
|
import {FrenchMonth, frEndJD, frStartJD, frSupportedYear, jdnFrench} from '@common/french';
|
||||||
import {JulianMonth} from '@common/gregorian';
|
|
||||||
import {TimeOfDay} from './TimeOfDay';
|
import {TimeOfDay} from './TimeOfDay';
|
||||||
import {GregorianJumper} from '@common/dateJump';
|
import {GregorianJumper} from '@common/dateJump';
|
||||||
import MonthBasedApp from '@common/ui/MonthBasedApp';
|
import MonthBasedApp from '@common/ui/MonthBasedApp';
|
||||||
|
@ -11,7 +10,7 @@ export default class App extends MonthBasedApp<number, FrenchMonth> {
|
||||||
override parseYearMonth(year: string, month: string) {
|
override parseYearMonth(year: string, month: string) {
|
||||||
if (!frSupportedYear(+year) || +month < 1 || +month > 13)
|
if (!frSupportedYear(+year) || +month < 1 || +month > 13)
|
||||||
return null;
|
return null;
|
||||||
return {year: +year, month: +month as JulianMonth};
|
return {year: +year, month: +month as FrenchMonth};
|
||||||
}
|
}
|
||||||
|
|
||||||
override defaultSelector(todayJDN: number) {
|
override defaultSelector(todayJDN: number) {
|
||||||
|
|
Loading…
Reference in a new issue