diff --git a/src/utils/countdown.ts b/src/utils/countdown.ts index f7c6ae6..6abfb9e 100644 --- a/src/utils/countdown.ts +++ b/src/utils/countdown.ts @@ -1,4 +1,5 @@ import { Lunar } from 'lunar-javascript'; +import { getLunarFromSolar } from './lunar'; export interface CountdownResult { days: number; @@ -267,12 +268,9 @@ export function getFriendlyDateDescription( const day = targetDate.getDate(); if (isLunar) { - // 显示农历 - const result = safeCreateLunarDate(targetDate.getFullYear(), month, day); - if (result) { - return `${result.lunar.getMonthInChinese()}月${result.lunar.getDayInChinese()}`; - } - return `${month}月${day}日`; + // 显示农历:使用 getLunarFromSolar 将公历日期正确转换为农历 + const lunarInfo = getLunarFromSolar(targetDate); + return `${lunarInfo.monthInChinese}${lunarInfo.dayInChinese}`; } return `${month}月${day}日`;