fix(client): 🐛 attempt to fix the one-off date issue

use utc functions from dayjs to correspond to the same date on the server
This commit is contained in:
Amruth Pillai
2022-07-31 02:13:08 -08:00
parent 1c19062c63
commit 5197f954c0
14 changed files with 33 additions and 25 deletions

View File

@ -140,7 +140,7 @@ const WorkModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
}}
renderInput={(params) => (
<TextField
@ -164,7 +164,7 @@ const WorkModal: React.FC = () => {
views={['year', 'month', 'day']}
onChange={(date: Date | null, keyboardInputValue: string | undefined) => {
isEmpty(keyboardInputValue) && field.onChange('');
date && dayjs(date).isValid() && field.onChange(date.toISOString());
date && dayjs(date).utc().isValid() && field.onChange(date.toISOString());
}}
renderInput={(params) => (
<TextField