diff --git a/src/pages/settings/Profile/CustomStatus/SetDatePage.tsx b/src/pages/settings/Profile/CustomStatus/SetDatePage.tsx index 5e165de3cc85..ae0b910dc01f 100644 --- a/src/pages/settings/Profile/CustomStatus/SetDatePage.tsx +++ b/src/pages/settings/Profile/CustomStatus/SetDatePage.tsx @@ -18,7 +18,7 @@ import ROUTES from '@src/ROUTES'; import INPUT_IDS from '@src/types/form/SettingsStatusClearDateForm'; import type * as OnyxTypes from '@src/types/onyx'; -type Date = { +type DateTime = { dateTime: string; }; @@ -33,7 +33,7 @@ function SetDatePage({customStatus}: SetDatePageProps) { const {translate} = useLocalize(); const customClearAfter = customStatus?.clearAfter ?? ''; - const onSubmit = (value: Date) => { + const onSubmit = (value: DateTime) => { User.updateDraftCustomStatus({clearAfter: DateUtils.combineDateAndTime(customClearAfter, value.dateTime)}); Navigation.goBack(ROUTES.SETTINGS_STATUS_CLEAR_AFTER); }; diff --git a/src/pages/settings/Profile/CustomStatus/SetTimePage.tsx b/src/pages/settings/Profile/CustomStatus/SetTimePage.tsx index b05a21967ee1..101f7269616d 100644 --- a/src/pages/settings/Profile/CustomStatus/SetTimePage.tsx +++ b/src/pages/settings/Profile/CustomStatus/SetTimePage.tsx @@ -43,10 +43,7 @@ function SetTimePage({customStatus}: SetTimePageProps) { /> diff --git a/src/pages/settings/Profile/CustomStatus/StatusClearAfterPage.tsx b/src/pages/settings/Profile/CustomStatus/StatusClearAfterPage.tsx index 8c6d382ffa01..598050686825 100644 --- a/src/pages/settings/Profile/CustomStatus/StatusClearAfterPage.tsx +++ b/src/pages/settings/Profile/CustomStatus/StatusClearAfterPage.tsx @@ -31,6 +31,7 @@ type StatusType = { }; type StatusClearAfterPageOnyxProps = { + /** User's custom status */ customStatus: OnyxEntry; }; @@ -61,8 +62,8 @@ const useValidateCustomDate = (data: string) => { setCustomTimeError(timeValidationErrorKey); return { - dateValidationErrorKey, - timeValidationErrorKey, + dateError: dateValidationErrorKey, + timeError: timeValidationErrorKey, }; }; @@ -109,7 +110,7 @@ function StatusClearAfterPage({customStatus}: StatusClearAfterPageProps) { ); const onSubmit = () => { - const {dateValidationErrorKey: dateError, timeValidationErrorKey: timeError} = validateCustomDate(); + const {dateError, timeError} = validateCustomDate(); if (dateError || timeError) { return; } @@ -118,7 +119,7 @@ function StatusClearAfterPage({customStatus}: StatusClearAfterPageProps) { calculatedDraftDate = draftClearAfter; } else { const selectedRange = statusType.find((item) => item.isSelected); - calculatedDraftDate = DateUtils.getDateFromStatusType(selectedRange?.value ?? 'never'); + calculatedDraftDate = DateUtils.getDateFromStatusType(selectedRange?.value ?? CONST.CUSTOM_STATUS_TYPES.NEVER); } User.updateDraftCustomStatus({clearAfter: calculatedDraftDate}); Navigation.goBack(ROUTES.SETTINGS_STATUS); @@ -135,7 +136,7 @@ function StatusClearAfterPage({customStatus}: StatusClearAfterPageProps) { User.updateDraftCustomStatus({clearAfter: DateUtils.getOneHourFromNow()}); } else { const selectedRange = statusType.find((item) => item.value === mode.value); - const calculatedDraftDate = DateUtils.getDateFromStatusType(selectedRange?.value ?? 'never'); + const calculatedDraftDate = DateUtils.getDateFromStatusType(selectedRange?.value ?? CONST.CUSTOM_STATUS_TYPES.NEVER); User.updateDraftCustomStatus({clearAfter: calculatedDraftDate}); Navigation.goBack(ROUTES.SETTINGS_STATUS); }