mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
Merge branch 'main' into next
This commit is contained in:
commit
9243a1199b
@ -82,6 +82,8 @@ const handleChangeOnFilter = (value, picker, showTime) => {
|
||||
return value;
|
||||
};
|
||||
export const handleDateChangeOnForm = (value, dateOnly, utc, picker, showTime, gmt) => {
|
||||
// @ts-ignore
|
||||
const currentTimeZone = dayjs.tz.guess();
|
||||
const format = showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';
|
||||
if (!value) {
|
||||
return value;
|
||||
@ -97,7 +99,8 @@ export const handleDateChangeOnForm = (value, dateOnly, utc, picker, showTime, g
|
||||
return dayjs(value).startOf(picker).toISOString();
|
||||
}
|
||||
const formattedDate = dayjs(value).format(format);
|
||||
return dayjs(formattedDate).toISOString();
|
||||
// @ts-ignore
|
||||
return dayjs(formattedDate).tz(currentTimeZone, true).toISOString();
|
||||
}
|
||||
if (showTime) {
|
||||
return dayjs(value).format(format);
|
||||
|
@ -81,7 +81,7 @@ const toMoment = (val: any, options?: Str2momentOptions) => {
|
||||
if (!val) {
|
||||
return;
|
||||
}
|
||||
const offset = options.utcOffset !== undefined ? options.utcOffset : -1 * new Date().getTimezoneOffset();
|
||||
const offset = options.utcOffset;
|
||||
const { gmt, picker, utc = true } = options;
|
||||
if (dayjs(val).isValid()) {
|
||||
if (!utc) {
|
||||
@ -94,7 +94,7 @@ const toMoment = (val: any, options?: Str2momentOptions) => {
|
||||
if (gmt) {
|
||||
return dayjs(val).utcOffset(0);
|
||||
}
|
||||
return dayjs(val).utcOffset(offsetFromString(offset));
|
||||
return offset ? dayjs(val).utcOffset(offsetFromString(offset)) : dayjs(val);
|
||||
} else {
|
||||
return convertQuarterToFirstDay(val);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user