fix: 修复 getLunarFromSolar 导出问题
- 在 lunar.ts 中添加 getLunarFromSolar 函数导出 - 移除 countdown.ts 中的重复定义 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7dd8d15c28
commit
11a7e2a06c
@ -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(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|||||||
@ -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(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是否为农历节日
|
* 判断是否为农历节日
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user