fix: 修复 getLunarFromSolar 导出问题

- 在 lunar.ts 中添加 getLunarFromSolar 函数导出
- 移除 countdown.ts 中的重复定义

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ddshi 2026-02-28 11:35:20 +08:00
parent 7dd8d15c28
commit 11a7e2a06c
2 changed files with 13 additions and 12 deletions

View File

@ -286,15 +286,3 @@ export function getSolarFromLunar(lunarMonth: number, lunarDay: number, year?: n
return new Date(solar.getYear(), solar.getMonth() - 1, solar.getDay()); return new Date(solar.getYear(), solar.getMonth() - 1, solar.getDay());
} }
/**
*
*/
export function getLunarFromSolar(solarDate: Date): { month: number; day: number; monthInChinese: string; dayInChinese: string } {
const lunar = Lunar.fromYmd(solarDate.getFullYear(), solarDate.getMonth() + 1, solarDate.getDate());
return {
month: lunar.getMonth(),
day: lunar.getDay(),
monthInChinese: lunar.getMonthInChinese(),
dayInChinese: lunar.getDayInChinese(),
};
}

View File

@ -137,6 +137,19 @@ export function getDayGanZhi(date: Date): string {
} }
} }
/**
*
*/
export function getLunarFromSolar(solarDate: Date): { month: number; day: number; monthInChinese: string; dayInChinese: string } {
const lunar = Lunar.fromYmd(solarDate.getFullYear(), solarDate.getMonth() + 1, solarDate.getDate());
return {
month: lunar.getMonth(),
day: lunar.getDay(),
monthInChinese: lunar.getMonthInChinese(),
dayInChinese: lunar.getDayInChinese(),
};
}
/** /**
* *
*/ */