- 筛选栏改为单行横排,概览精简为一行文字 - 任务列表全宽展示,日志移到底部可折叠 - 页面使用百分比布局,一屏展示无外层滚动 - 登录任务增加单条删除和批量删除功能 - 后端: datetime.utcnow 替换为 datetime.now(timezone.utc) - 后端: schemas 序列化统一输出带时区 ISO 格式 - 前端: 新增 utils/time.ts 统一时间格式化工具 - 前端: CookiePage/LoginTasksPage 时间列使用 formatTime() Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
25 lines
741 B
TypeScript
25 lines
741 B
TypeScript
import dayjs from 'dayjs';
|
|
import utc from 'dayjs/plugin/utc';
|
|
import timezone from 'dayjs/plugin/timezone';
|
|
|
|
dayjs.extend(utc);
|
|
dayjs.extend(timezone);
|
|
|
|
/**
|
|
* 将后端返回的 ISO 时间字符串格式化为本地可读格式。
|
|
* 后端统一输出带时区的 ISO 字符串(如 2026-06-22T15:51:26+00:00),
|
|
* 此函数自动转为本地时区并格式化为 "YYYY-MM-DD HH:mm:ss"。
|
|
*/
|
|
export function formatTime(val: string | null | undefined): string {
|
|
if (!val) return '-';
|
|
return dayjs(val).format('YYYY-MM-DD HH:mm:ss');
|
|
}
|
|
|
|
/**
|
|
* 简短格式,仅显示月-日 时:分
|
|
*/
|
|
export function formatTimeShort(val: string | null | undefined): string {
|
|
if (!val) return '-';
|
|
return dayjs(val).format('MM-DD HH:mm');
|
|
}
|