|
|
|
|
@ -18,7 +18,13 @@ async function queryAlmanac(date) { |
|
|
|
|
date = tomorrow.toISOString().split('T')[0]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const query = `2026 年 2 月 24 日 农历黄历 宜忌 正月初八`; |
|
|
|
|
// 动态计算农历日期(基于 2026 年春节 2 月 17 日)
|
|
|
|
|
const targetDate = date ? new Date(date) : new Date(); |
|
|
|
|
const springFestival = new Date('2026-02-17'); // 2026 年春节
|
|
|
|
|
const lunarDay = Math.floor((targetDate - springFestival) / (1000 * 60 * 60 * 24)) + 1; |
|
|
|
|
const lunarDateStr = `农历正月初${lunarDay}`; |
|
|
|
|
|
|
|
|
|
const query = `2026 年 2 月 24 日 黄历 宜忌 ${lunarDateStr}`; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
const response = await fetch('https://api.tavily.com/search', { |
|
|
|
|
@ -48,7 +54,7 @@ async function queryAlmanac(date) { |
|
|
|
|
return { |
|
|
|
|
success: true, |
|
|
|
|
date: date, |
|
|
|
|
lunarDate: almanacInfo.lunarDate, |
|
|
|
|
lunarDate: lunarDateStr, // 使用动态计算的农历日期
|
|
|
|
|
weekday: almanacInfo.weekday, |
|
|
|
|
yi: almanacInfo.yi, // 宜
|
|
|
|
|
ji: almanacInfo.ji, // 忌
|
|
|
|
|
|