fix(cert): 修正证书过期时间计算逻辑

This commit is contained in:
xiaojunnuo
2025-05-20 23:19:50 +08:00
parent 1eb9bd34fd
commit a3086e6a5b
3 changed files with 35 additions and 1 deletions

View File

@@ -145,7 +145,8 @@ export abstract class CertApplyBasePlugin extends CertApplyBaseConvertPlugin {
throw new Error("过期时间不能为空");
}
// 检查有效期
const leftDays = dayjs(expires).diff(dayjs(), "day");
const leftDays = Math.floor((expires - dayjs().valueOf()) / (1000 * 60 * 60 * 24));
this.logger.info(`证书剩余天数:${leftDays}`);
return {
isWillExpire: leftDays <= maxDays,
leftDays,