fix(培训签到):签到明细列口径调整——学员列显示「姓名 工号」、签到时间显示北京时间时分秒(新增 fmtBeijingTimeSec)、方式列显示中文(企微扫码/代扫码补录);代扫码补录学员下拉同步显示姓名
deploy-hxtesting / build-and-deploy (push) Successful in 1m5s
deploy-hxtesting / build-and-deploy (push) Successful in 1m5s
This commit is contained in:
1 parent
eb09f8235b
commit
9e00af1905
2 files changed
+35
-8
No files matched your search
@@ -17,6 +17,17 @@ const BEIJING_CLOCK = new Intl.DateTimeFormat('zh-CN', {
|
||||
hour12: false,
|
||||
})
|
||||
|
||||
const BEIJING_DATETIME_SEC = new Intl.DateTimeFormat('zh-CN', {
|
||||
timeZone: 'Asia/Shanghai',
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
hour12: false,
|
||||
})
|
||||
|
||||
/** fmtBeijingTime 任意时间戳 → 北京时间「YYYY/MM/DD HH:mm」(无秒);空/非法输入返回空串。 */
|
||||
export function fmtBeijingTime(raw: string | number | Date | null | undefined): string {
|
||||
if (raw === null || raw === undefined || raw === '') return ''
|
||||
@@ -32,3 +43,11 @@ export function fmtBeijingClock(raw: string | number | Date | null | undefined):
|
||||
if (Number.isNaN(date.getTime())) return ''
|
||||
return BEIJING_CLOCK.format(date)
|
||||
}
|
||||
|
||||
/** fmtBeijingTimeSec 北京时间「YYYY/MM/DD HH:mm:ss」(带秒;签到明细等需秒级精度的场景)。 */
|
||||
export function fmtBeijingTimeSec(raw: string | number | Date | null | undefined): string {
|
||||
if (raw === null || raw === undefined || raw === '') return ''
|
||||
const date = raw instanceof Date ? raw : new Date(raw)
|
||||
if (Number.isNaN(date.getTime())) return ''
|
||||
return BEIJING_DATETIME_SEC.format(date)
|
||||
}
|
||||
Reference in new issue
Block a user