Browse Source

BI-147341 fix:contentFormat未考虑时区问题

master^2^2
chenzeyu 7 months ago
parent
commit
f0e91077bb
  1. 7
      packages/fineui/src/core/func/alias.js

7
packages/fineui/src/core/func/alias.js

@ -9,7 +9,8 @@ import {
leftPad, leftPad,
parseDateTime, parseDateTime,
values, values,
isArray isArray,
getDate
} from "../2.base"; } from "../2.base";
import { replaceAll } from "./string"; import { replaceAll } from "./string";
import { getFullDayName, getMonthName, getTimezone } from "./date"; import { getFullDayName, getMonthName, getTimezone } from "./date";
@ -680,10 +681,10 @@ export const contentFormat = function(cv, fmt) {
if (!(cv instanceof Date)) { if (!(cv instanceof Date)) {
if (typeof cv === "number") { if (typeof cv === "number") {
// 毫秒数类型 // 毫秒数类型
cv = new Date(cv); cv = getDate(cv);
} else { } else {
// 字符串类型转化为date类型 // 字符串类型转化为date类型
cv = new Date(Date.parse((`${cv}`).replace(/-|\./g, "/"))); cv = getDate(Date.parse((`${cv}`).replace(/-|\./g, "/")));
} }
} }
if (!isInvalidDate(cv) && !isNull(cv)) { if (!isInvalidDate(cv) && !isNull(cv)) {

Loading…
Cancel
Save