1
0

fix: 安全性与代码质量加固(异常保护、外键级联、竞态修复、优雅关机)

This commit is contained in:
2026-05-11 14:24:12 +08:00
parent 35ba56888b
commit 0ee10b47c9
17 changed files with 132 additions and 33 deletions

View File

@@ -1,4 +1,5 @@
import { useState } from "react";
import { subtractHours } from "../utils/time";
interface TimeRangePickerProps {
from: string;
@@ -18,12 +19,6 @@ function toLocalDatetimeInput(date: Date): string {
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
}
function subtractHours(date: Date, hours: number): Date {
const result = new Date(date);
result.setTime(result.getTime() - hours * 60 * 60 * 1000);
return result;
}
export function TimeRangePicker({ from, to, onChange }: TimeRangePickerProps) {
const [activeShortcut, setActiveShortcut] = useState<string | null>("24h");