对齐官方 WebSocket 批量握手、注册、心跳、ACK、同步恢复及运行时设备标识生命周期。 保留 Cookie 完整属性,接入静默续期和保存登录信息设置,并在凭证更新后重建账号连接。 完善订单与商品同步、卡券和通知渠道交互,更新前端品牌、时间展示及嵌入资源。 补充 Go 与前端回归测试,确保完整检查和生产构建通过。
20 lines
676 B
TypeScript
20 lines
676 B
TypeScript
const padTwoDigits = (value: number): string => String(value).padStart(2, '0');
|
|
|
|
/** Format a timestamp in the browser's current timezone. */
|
|
export const formatLocalDateTime = (value?: string | number | Date | null): string => {
|
|
if (value === undefined || value === null || value === '') return '-';
|
|
|
|
const date = value instanceof Date ? value : new Date(value);
|
|
if (Number.isNaN(date.getTime())) return '-';
|
|
|
|
return [
|
|
date.getFullYear(),
|
|
padTwoDigits(date.getMonth() + 1),
|
|
padTwoDigits(date.getDate()),
|
|
].join('-') + ' ' + [
|
|
padTwoDigits(date.getHours()),
|
|
padTwoDigits(date.getMinutes()),
|
|
padTwoDigits(date.getSeconds()),
|
|
].join(':');
|
|
};
|