0.8.4.0
This commit is contained in:
+17
-1
@@ -290,7 +290,23 @@ export function isInCurrentMonth(dateStr: string, isLunar: boolean = false): { d
|
||||
originalLunar.isLeap
|
||||
)
|
||||
|
||||
if (!thisYearSolar) return null
|
||||
if (!thisYearSolar) {
|
||||
// 如果转换失败,尝试用明年的日期
|
||||
const nextYearSolar = lunar2solar(
|
||||
currentYear + 1,
|
||||
originalLunar.lunarMonth,
|
||||
originalLunar.lunarDay,
|
||||
originalLunar.isLeap
|
||||
)
|
||||
if (nextYearSolar) {
|
||||
const nextYearMonth = nextYearSolar.getMonth() + 1
|
||||
const nextYearDay = nextYearSolar.getDate()
|
||||
if (nextYearMonth === currentMonth) {
|
||||
return { day: nextYearDay, month: nextYearMonth }
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
const thisYearMonth = thisYearSolar.getMonth() + 1
|
||||
const thisYearDay = thisYearSolar.getDate()
|
||||
|
||||
Reference in New Issue
Block a user