This commit is contained in:
+5
-2
@@ -351,12 +351,15 @@ class CountdownUpdate(BaseModel):
|
||||
def countdown_dict(row: Countdown, today: date | None = None):
|
||||
today = today or datetime.now(ZoneInfo("Asia/Shanghai")).date()
|
||||
if row.calendar_mode == "lunar" and (row.ignore_year or row.repeat_rule != "none"):
|
||||
# 农历按年重复:忽略年份或指定重复时,都按“每年农历”语义计算下一次
|
||||
display_date = next_lunar_occurrence(
|
||||
row.lunar_month, row.lunar_day, row.ignore_year, row.repeat_rule, today
|
||||
row.lunar_month, row.lunar_day, True, "yearly", today
|
||||
) or row.event_date
|
||||
effective_repeat = "yearly"
|
||||
else:
|
||||
repeat_rule = "yearly" if row.ignore_year else row.repeat_rule
|
||||
display_date = countdown_occurrence(row.event_date, repeat_rule, today)
|
||||
effective_repeat = repeat_rule
|
||||
days, day_text = countdown_status(display_date, today)
|
||||
lunar_year = None
|
||||
lunar_text = None
|
||||
@@ -377,9 +380,9 @@ def countdown_dict(row: Countdown, today: date | None = None):
|
||||
"lunar_month": row.lunar_month,
|
||||
"lunar_day": row.lunar_day,
|
||||
"ignore_year": row.ignore_year,
|
||||
"repeat_rule": effective_repeat,
|
||||
"lunar_text": lunar_text,
|
||||
"kind": row.kind,
|
||||
"repeat_rule": row.repeat_rule,
|
||||
"icon": row.icon,
|
||||
"pinned": row.pinned,
|
||||
"archived_at": row.archived_at,
|
||||
|
||||
Reference in New Issue
Block a user