feat(web): 时间选择器增加「今天」快捷项

北京日界左闭右开;相对窗口可跨日自动重算。
This commit is contained in:
2026-10-12 15:00:29 +08:00
parent d0bab545b1
commit 9966f03347
7 changed files with 33 additions and 8 deletions
+8
View File
@@ -83,6 +83,14 @@ export function recentDaysRange(
return { from: shanghaiIso(from), to: shanghaiIso(to) };
}
/** 快捷项:今天(北京时间日界,左闭右开) */
export function todayRange(nowMs: number = Date.now()): {
from: string;
to: string;
} {
return recentDaysRange(1, nowMs);
}
/** 统计口径标注:「2026-09-02 ~ 10-01」(北京时间日) */
export function formatRangeCaption(fromIso: string, toIso: string): string {
if (!fromIso || !toIso) return "—";