mirror of
https://github.com/nocobase/nocobase
synced 2024-11-14 16:43:01 +00:00
fix: incorrect time display for noTimeZone datetime field with showTi… (#5458)
Some checks failed
Build docker image / build-and-push (push) Waiting to run
Build pro image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase frontEnd test / frontend-test (18) (push) Waiting to run
NocoBase backend test / sqlite-test (20, false) (push) Has been cancelled
NocoBase backend test / sqlite-test (20, true) (push) Has been cancelled
NocoBase backend test / postgres-test (public, 20, nocobase, false) (push) Has been cancelled
NocoBase backend test / postgres-test (public, 20, nocobase, true) (push) Has been cancelled
NocoBase backend test / postgres-test (public, 20, public, false) (push) Has been cancelled
NocoBase backend test / postgres-test (public, 20, public, true) (push) Has been cancelled
NocoBase backend test / postgres-test (user_schema, 20, nocobase, false) (push) Has been cancelled
NocoBase backend test / postgres-test (user_schema, 20, nocobase, true) (push) Has been cancelled
NocoBase backend test / postgres-test (user_schema, 20, public, false) (push) Has been cancelled
NocoBase backend test / postgres-test (user_schema, 20, public, true) (push) Has been cancelled
NocoBase backend test / mysql-test (20, false) (push) Has been cancelled
NocoBase backend test / mysql-test (20, true) (push) Has been cancelled
NocoBase backend test / mariadb-test (20, false) (push) Has been cancelled
NocoBase backend test / mariadb-test (20, true) (push) Has been cancelled
Test on Windows / build (push) Has been cancelled
Some checks failed
Build docker image / build-and-push (push) Waiting to run
Build pro image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase frontEnd test / frontend-test (18) (push) Waiting to run
NocoBase backend test / sqlite-test (20, false) (push) Has been cancelled
NocoBase backend test / sqlite-test (20, true) (push) Has been cancelled
NocoBase backend test / postgres-test (public, 20, nocobase, false) (push) Has been cancelled
NocoBase backend test / postgres-test (public, 20, nocobase, true) (push) Has been cancelled
NocoBase backend test / postgres-test (public, 20, public, false) (push) Has been cancelled
NocoBase backend test / postgres-test (public, 20, public, true) (push) Has been cancelled
NocoBase backend test / postgres-test (user_schema, 20, nocobase, false) (push) Has been cancelled
NocoBase backend test / postgres-test (user_schema, 20, nocobase, true) (push) Has been cancelled
NocoBase backend test / postgres-test (user_schema, 20, public, false) (push) Has been cancelled
NocoBase backend test / postgres-test (user_schema, 20, public, true) (push) Has been cancelled
NocoBase backend test / mysql-test (20, false) (push) Has been cancelled
NocoBase backend test / mysql-test (20, true) (push) Has been cancelled
NocoBase backend test / mariadb-test (20, false) (push) Has been cancelled
NocoBase backend test / mariadb-test (20, true) (push) Has been cancelled
Test on Windows / build (push) Has been cancelled
* fix: incorrect time display for noTimeZone datetime field with showTime enabled * fix: test
This commit is contained in:
parent
2ccfaf4f76
commit
012f648bb2
@ -62,7 +62,7 @@ describe('mapDatePicker', () => {
|
||||
};
|
||||
const result = mapDatePicker()(props);
|
||||
result.onChange(dayjs.utc('2022-02-22 22:22:22'));
|
||||
expect(props.onChange).toHaveBeenCalledWith('2022-02-22 00:00:00');
|
||||
expect(props.onChange).toHaveBeenCalledWith('2022-02-22 22:22:22');
|
||||
});
|
||||
|
||||
it('should call onChange with correct value when showTime is true and gmt is false', () => {
|
||||
@ -74,7 +74,7 @@ describe('mapDatePicker', () => {
|
||||
const result = mapDatePicker()(props);
|
||||
const m = dayjs('2022-02-22 22:22:22');
|
||||
result.onChange(m);
|
||||
expect(props.onChange).toHaveBeenCalledWith('2022-02-22 00:00:00');
|
||||
expect(props.onChange).toHaveBeenCalledWith('2022-02-22 22:22:22');
|
||||
});
|
||||
|
||||
it('should call onChange with correct value when showTime is false and gmt is true', () => {
|
||||
@ -202,7 +202,7 @@ describe('mapDatePicker', () => {
|
||||
};
|
||||
const result = mapDatePicker()(props);
|
||||
result.onChange(dayjs('2022-02-22 22:22:22'));
|
||||
expect(props.onChange).toHaveBeenCalledWith('2022-02-22 00:00:00');
|
||||
expect(props.onChange).toHaveBeenCalledWith('2022-02-22 22:22:22');
|
||||
});
|
||||
|
||||
it('should call onChange with correct value when picker is year and utc is false', () => {
|
||||
|
@ -100,6 +100,9 @@ const handleChangeOnForm = (value, dateOnly, utc, picker, showTime, gmt) => {
|
||||
const formattedDate = dayjs(value).format(format);
|
||||
return dayjs(formattedDate).toISOString();
|
||||
}
|
||||
if (showTime) {
|
||||
return dayjs(value).format(format);
|
||||
}
|
||||
return dayjs(value).startOf(picker).format(format);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user