Skip to content

Commit

Permalink
Update dayjs.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
vaynevayne committed Aug 4, 2023
1 parent 3aeaec5 commit d97d6b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/_util/dayjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import weekOfYear from 'dayjs/plugin/weekOfYear';
import AdvancedFormat from 'dayjs/plugin/advancedFormat';
import weekYear from 'dayjs/plugin/weekYear';
import QuarterOfYear from 'dayjs/plugin/quarterOfYear';
import utc from 'dayjs/plugin/utc';
import { isDayjs, isArray, isUndefined } from '../_util/is';

const isMoment = (originDayjs() as any)._isAMomentObject;
Expand Down Expand Up @@ -43,6 +44,7 @@ originDayjs.extend(weekOfYear);
originDayjs.extend(AdvancedFormat);
originDayjs.extend(weekYear);
originDayjs.extend(QuarterOfYear);
originDayjs.extend(utc);

export const dayjs = originDayjs;

Expand Down Expand Up @@ -221,7 +223,7 @@ export function getDayjsValue(time, format: string, utcOffset?: number, timezone
}
const formatValue = (value) => {
if (isDayjs(value)) {
return value;
return dayjs(value.isUTC() ? dayjs.utc(value).format(format): value)
}
if (typeof value === 'string') {
const dv = dayjs(value, format);
Expand Down

0 comments on commit d97d6b8

Please sign in to comment.