mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +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;
|
return value;
|
||||||
};
|
};
|
||||||
export const handleDateChangeOnForm = (value, dateOnly, utc, picker, showTime, gmt) => {
|
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';
|
const format = showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return value;
|
return value;
|
||||||
@ -97,7 +99,8 @@ export const handleDateChangeOnForm = (value, dateOnly, utc, picker, showTime, g
|
|||||||
return dayjs(value).startOf(picker).toISOString();
|
return dayjs(value).startOf(picker).toISOString();
|
||||||
}
|
}
|
||||||
const formattedDate = dayjs(value).format(format);
|
const formattedDate = dayjs(value).format(format);
|
||||||
return dayjs(formattedDate).toISOString();
|
// @ts-ignore
|
||||||
|
return dayjs(formattedDate).tz(currentTimeZone, true).toISOString();
|
||||||
}
|
}
|
||||||
if (showTime) {
|
if (showTime) {
|
||||||
return dayjs(value).format(format);
|
return dayjs(value).format(format);
|
||||||
|
@ -81,7 +81,7 @@ const toMoment = (val: any, options?: Str2momentOptions) => {
|
|||||||
if (!val) {
|
if (!val) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const offset = options.utcOffset !== undefined ? options.utcOffset : -1 * new Date().getTimezoneOffset();
|
const offset = options.utcOffset;
|
||||||
const { gmt, picker, utc = true } = options;
|
const { gmt, picker, utc = true } = options;
|
||||||
if (dayjs(val).isValid()) {
|
if (dayjs(val).isValid()) {
|
||||||
if (!utc) {
|
if (!utc) {
|
||||||
@ -94,7 +94,7 @@ const toMoment = (val: any, options?: Str2momentOptions) => {
|
|||||||
if (gmt) {
|
if (gmt) {
|
||||||
return dayjs(val).utcOffset(0);
|
return dayjs(val).utcOffset(0);
|
||||||
}
|
}
|
||||||
return dayjs(val).utcOffset(offsetFromString(offset));
|
return offset ? dayjs(val).utcOffset(offsetFromString(offset)) : dayjs(val);
|
||||||
} else {
|
} else {
|
||||||
return convertQuarterToFirstDay(val);
|
return convertQuarterToFirstDay(val);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user