diff --git a/client/components/shared/ResumeInput.tsx b/client/components/shared/ResumeInput.tsx index 8ad8ce64..7ce1ec1a 100644 --- a/client/components/shared/ResumeInput.tsx +++ b/client/components/shared/ResumeInput.tsx @@ -22,6 +22,7 @@ const ResumeInput: React.FC = ({ type = 'text', label, path, className, m const dispatch = useAppDispatch(); const stateValue = useAppSelector((state) => get(state.resume.present, path, '')); + const dateFormat = useAppSelector((state) => state.resume.present.metadata.date.format); useEffect(() => { setValue(stateValue); @@ -56,14 +57,16 @@ const ResumeInput: React.FC = ({ type = 'text', label, path, className, m if (type === 'date') { return ( } onChange={(date: Date | null, keyboardInputValue: string | undefined) => { isEmpty(keyboardInputValue) && onChangeValue(''); - date && dayjs(date).utc().isValid() && onChangeValue(dayjs(date).utc().toISOString()); + date && dayjs(date).isValid() && onChangeValue(dayjs(date).format('YYYY-MM-DD')); }} /> ); diff --git a/client/utils/date.ts b/client/utils/date.ts index 89c333c1..fafdecaa 100644 --- a/client/utils/date.ts +++ b/client/utils/date.ts @@ -30,7 +30,7 @@ export const formatDateString = (date: string | DateRange, formatStr: string): s if (isString(date)) { if (!dayjs(date).isValid()) return null; - return dayjs(date).utc(true).format(formatStr); + return dayjs(date).format(formatStr); } // If `date` is a DateRange @@ -39,8 +39,8 @@ export const formatDateString = (date: string | DateRange, formatStr: string): s if (!dayjs(date.start).isValid()) return null; if (!isEmpty(date.end) && dayjs(date.end).isValid()) { - return `${dayjs(date.start).utc(true).format(formatStr)} - ${dayjs(date.end).utc(true).format(formatStr)}`; + return `${dayjs(date.start).format(formatStr)} - ${dayjs(date.end).format(formatStr)}`; } - return `${dayjs(date.start).utc(true).format(formatStr)} - ${presentString}`; + return `${dayjs(date.start).format(formatStr)} - ${presentString}`; };