merge: 同步 upstream/main 新功能到定制版本
- 分流规则 + 用户流量统计 - 验证码功能 - 节点分组管理 UI - 重构用户分组组件
This commit is contained in:
@@ -24,9 +24,18 @@ export function differenceInDays(date1: Date, date2: Date): number {
|
||||
|
||||
export function formatDate(date?: Date | number, showTime = true) {
|
||||
if (!date) return;
|
||||
|
||||
// Backend returns Unix timestamps in seconds; convert to milliseconds for JS Date
|
||||
const dateValue =
|
||||
typeof date === "number" && date < 1e12 ? date * 1000 : date;
|
||||
// Unix timestamps (seconds): 10 digits e.g. 1771936457
|
||||
// JavaScript timestamps (milliseconds): 13 digits
|
||||
let dateValue = date;
|
||||
if (typeof date === "number") {
|
||||
if (date < 10000000000) {
|
||||
dateValue = date * 1000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const timeZone = localStorage.getItem("timezone") || "UTC";
|
||||
return intlFormat(dateValue, {
|
||||
year: "numeric",
|
||||
|
||||
Reference in New Issue
Block a user