fix(server): 时间戳→业务日期/时间全部统一为中国时区(UTC+8)

此前仅'今天'默认值统一为中国日期,Date→字符串的转换仍是 UTC:
- sync 考勤同步窗口 lastSyncAt 时间戳按 UTC 取日期,凌晨会偏一天
- 考勤导出 punchTime/createdAt 显示 UTC 时间
- normalizeDateOnly 把 ISO datetime 按 UTC 归一化,业务日期少一天
- getCourseClock/getChinaDateParts 用 dayjs.utc(date).add(8h) 隐式转换

统一为 dayjs(date).utcOffset(8),纯日期字符串运算(shiftDate/addDays/
daysInMonth/nextMonth)保留 dayjs.utc;date-normalization 测试断言
同步更新为北京时间语义。
This commit is contained in:
2026-08-08 18:01:35 +08:00
parent 7905f1ee23
commit 4dd7b5a0b1
19 changed files with 26 additions and 25 deletions

View File

@@ -159,7 +159,7 @@ export class OccupancyOperationsService {
const transferDate = new Date(dto.transferDate);
const nextDay = new Date(transferDate);
nextDay.setDate(nextDay.getDate() + 1);
const defaultBillingStart = dayjs(nextDay).utc().format('YYYY-MM-DD');
const defaultBillingStart = dayjs(nextDay).utcOffset(8).format('YYYY-MM-DD');
this.assertDateOrder(
dto.transferDate,
dto.newBillingStartDate || defaultBillingStart,