Use when adding a new 選日 (senjitsu/selected day) to the Japanese calendar tool. Guides research of calculation rules, calendar type (暦月 vs 節月), and implementation across all layers.
Before writing any code, investigate the 選日 on Wikipedia (Japanese) to determine:
getStarDate() to find the 節入り date and determine the current solar month. Examples: 一粒万倍日, 天赦日, 三隣亡getOldCalendarDate() to get the lunar month/day. Examples: 不成就日isLucky)Getting the calendar type wrong (節月 vs 旧暦) is the most common and critical mistake. Many online sources are ambiguous. Always verify against Wikipedia's description and a published calendar.
src/lib/calculations/senjitsu.tsAdd entry to SENJITSU_TYPES:
MY_SENJITSU: {
name: "漢字名",
reading: "ひらがな読み",
romaji: "Romaji-name",
meaning: "English description of meaning and significance.",
meaningJa: "日本語での意味の説明。",
isLucky: true, // or false
},
src/lib/calculations/senjitsu.tsIn the getSenjitsu() function, add the check. Follow existing patterns:
solarMonth (already computed) and dayBranchIndex/dayStemIndex from getDayZodiac()oldDate from getOldCalendarDate() (already computed)const MY_TABLE: Record<number, number[]> = { ... })src/lib/i18n/ja.json - Add Japanese label if neededsrc/lib/i18n/en.json - Add English label if neededsrc/app/[lang]/about/senjitsu/ClientPage.tsx - Add explanation for the new 選日src/components/icons/SenjitsuIcon.tsx - Add icon/color for the new typetests/senjitsu.spec.ts using known dates from a published calendarnpx playwright test tests/senjitsu.spec.ts to confirm tests passsolarMonth is computed by comparing the date against getStarDate(). Month 1 = 小寒〜立春 (roughly Jan), Month 2 = 立春〜啓蟄 (roughly Feb), etc.