|
@@ -233,8 +233,12 @@ const calcMonthsBetween = (startStr: string, endStr: string): number | null => {
|
|
|
const start = parseChineseDate(startStr)
|
|
const start = parseChineseDate(startStr)
|
|
|
const end = parseChineseDate(endStr)
|
|
const end = parseChineseDate(endStr)
|
|
|
if (!start || !end || end < start) return null
|
|
if (!start || !end || end < start) return null
|
|
|
- // 直接按"年月差"计算整月数,末尾差几天不影响(如 2026-08-15 → 2028-08-14 = 24 个月)
|
|
|
|
|
- return (end.getFullYear() - start.getFullYear()) * 12 + (end.getMonth() - start.getMonth())
|
|
|
|
|
|
|
+ // 合同场景下截止日通常为到期日的前一天(如 2026-09-01 至 2028-08-31 = 24 个月)
|
|
|
|
|
+ // 因此把结束日期 +1 天后再计算年月差,保证"前一天到期"的情况算满整月
|
|
|
|
|
+ const endNext = new Date(end.getFullYear(), end.getMonth(), end.getDate() + 1)
|
|
|
|
|
+ return (
|
|
|
|
|
+ (endNext.getFullYear() - start.getFullYear()) * 12 + (endNext.getMonth() - start.getMonth())
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const isIdCardType = (papersType: any): boolean => {
|
|
const isIdCardType = (papersType: any): boolean => {
|