From e2cbc50a48e315361b78fe918f984c96bd7fde2e Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 24 Apr 2024 15:54:32 +0700 Subject: [PATCH 1/7] fix: Can't update the custom time of the status to 00:59 --- src/components/TimePicker/TimePicker.tsx | 14 ++++++++++++-- src/languages/en.ts | 1 + src/languages/es.ts | 1 + src/libs/DateUtils.ts | 8 -------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/components/TimePicker/TimePicker.tsx b/src/components/TimePicker/TimePicker.tsx index 6e36c0f824e2..d9ab4e80f1a4 100644 --- a/src/components/TimePicker/TimePicker.tsx +++ b/src/components/TimePicker/TimePicker.tsx @@ -112,6 +112,7 @@ function TimePicker({defaultValue = '', onSubmit, onInputChange = () => {}}: Tim const canUseTouchScreen = DeviceCapabilities.canUseTouchScreen(); const [isError, setError] = useState(false); + const [errorMessage, setErrorMessage] = useState(''); const [selectionHour, setSelectionHour] = useState({start: 0, end: 0}); const [selectionMinute, setSelectionMinute] = useState({start: 2, end: 2}); // we focus it by default so need to have selection on the end const [hours, setHours] = useState(() => DateUtils.get12HourTimeObjectFromDate(value).hour); @@ -129,8 +130,17 @@ function TimePicker({defaultValue = '', onSubmit, onInputChange = () => {}}: Tim const validate = useCallback( (time: string) => { - const isValid = DateUtils.isTimeAtLeastOneMinuteInFuture({timeString: time || `${hours}:${minutes} ${amPmValue}`, dateTimeString: defaultValue}); + const timeString = time || `${hours}:${minutes} ${amPmValue}`; + const [hourStr] = timeString.split(/[:\s]+/); + const hour = parseInt(hourStr, 10); + if (hour === 0) { + setError(true); + setErrorMessage('common.error.invalidTimeRange'); + return false; + } + const isValid = DateUtils.isTimeAtLeastOneMinuteInFuture({timeString, dateTimeString: defaultValue}); setError(!isValid); + setErrorMessage('common.error.invalidTimeShouldBeFuture'); return isValid; }, [hours, minutes, amPmValue, defaultValue], @@ -523,7 +533,7 @@ function TimePicker({defaultValue = '', onSubmit, onInputChange = () => {}}: Tim {isError ? ( ) : ( diff --git a/src/languages/en.ts b/src/languages/en.ts index d3ffbc9bb368..4f439de6c831 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -238,6 +238,7 @@ export default { enterMerchant: 'Enter a merchant name', enterAmount: 'Enter an amount', enterDate: 'Enter a date', + invalidTimeRange: 'Please enter a time using the 12-hour clock format (e.g., 2:30 PM).', }, comma: 'comma', semicolon: 'semicolon', diff --git a/src/languages/es.ts b/src/languages/es.ts index 0980ec5dcac5..29e92c81fa27 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -228,6 +228,7 @@ export default { enterMerchant: 'Introduce un comerciante', enterAmount: 'Introduce un importe', enterDate: 'Introduce una fecha', + invalidTimeRange: 'Introduzca una hora utilizando el formato de reloj de 12 horas (por ejemplo, 14:30).', }, comma: 'la coma', semicolon: 'el punto y coma', diff --git a/src/libs/DateUtils.ts b/src/libs/DateUtils.ts index a5949006501d..b44deb5f0434 100644 --- a/src/libs/DateUtils.ts +++ b/src/libs/DateUtils.ts @@ -663,14 +663,6 @@ const isTimeAtLeastOneMinuteInFuture = ({timeString, dateTimeString}: {timeStrin let dateToCheck = dateTimeString; if (timeString) { // return false; - // Parse the hour and minute from the time input - const [hourStr] = timeString.split(/[:\s]+/); - const hour = parseInt(hourStr, 10); - - if (hour === 0) { - return false; - } - dateToCheck = combineDateAndTime(timeString, dateTimeString); } From 3c420c0c18d6755c6a327c434068b96f8d5bd1cc Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 24 Apr 2024 15:55:42 +0700 Subject: [PATCH 2/7] fix error message es --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 29e92c81fa27..7e9b11a4d70d 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -228,7 +228,7 @@ export default { enterMerchant: 'Introduce un comerciante', enterAmount: 'Introduce un importe', enterDate: 'Introduce una fecha', - invalidTimeRange: 'Introduzca una hora utilizando el formato de reloj de 12 horas (por ejemplo, 14:30).', + invalidTimeRange: 'Introduzca una hora utilizando el formato de reloj de 12 horas (por ejemplo, 2:30PM).', }, comma: 'la coma', semicolon: 'el punto y coma', From 19d8fd8782e90977b6f6d09f8f84eef7fd9155d4 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 24 Apr 2024 16:11:48 +0700 Subject: [PATCH 3/7] fix time error style --- ios/Podfile.lock | 7 +++---- src/components/TimePicker/TimePicker.tsx | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 6ef495a65bd3..ff028d5a9e46 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -2083,6 +2083,7 @@ DEPENDENCIES: - ExpoImageManipulator (from `../node_modules/expo-image-manipulator/ios`) - ExpoModulesCore (from `../node_modules/expo-modules-core`) - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) + - "fullstory_react-native (from `../node_modules/@fullstory/react-native`)" - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) - libevent (~> 2.1.12) @@ -2248,8 +2249,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/Libraries/FBLazyVector" fullstory_react-native: :path: "../node_modules/@fullstory/react-native" - FBReactNativeSpec: - :path: "../node_modules/react-native/React/FBReactNativeSpec" glog: :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" hermes-engine: @@ -2586,8 +2585,8 @@ SPEC CHECKSUMS: SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Turf: 13d1a92d969ca0311bbc26e8356cca178ce95da2 VisionCamera: 3033e0dd5272d46e97bcb406adea4ae0e6907abf - Yoga: 64cd2a583ead952b0315d5135bf39e053ae9be70 + Yoga: 1b901a6d6eeba4e8a2e8f308f708691cdb5db312 PODFILE CHECKSUM: a25a81f2b50270f0c0bd0aff2e2ebe4d0b4ec06d -COCOAPODS: 1.13.0 +COCOAPODS: 1.14.3 diff --git a/src/components/TimePicker/TimePicker.tsx b/src/components/TimePicker/TimePicker.tsx index d9ab4e80f1a4..2cac08b42716 100644 --- a/src/components/TimePicker/TimePicker.tsx +++ b/src/components/TimePicker/TimePicker.tsx @@ -534,7 +534,7 @@ function TimePicker({defaultValue = '', onSubmit, onInputChange = () => {}}: Tim ) : ( From ad8ab143d4ae82732fbbf09990618518a9d66979 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 24 Apr 2024 16:42:24 +0700 Subject: [PATCH 4/7] revert pod file --- ios/Podfile.lock | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index ff028d5a9e46..6ef495a65bd3 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -2083,7 +2083,6 @@ DEPENDENCIES: - ExpoImageManipulator (from `../node_modules/expo-image-manipulator/ios`) - ExpoModulesCore (from `../node_modules/expo-modules-core`) - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) - - "fullstory_react-native (from `../node_modules/@fullstory/react-native`)" - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) - libevent (~> 2.1.12) @@ -2249,6 +2248,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/Libraries/FBLazyVector" fullstory_react-native: :path: "../node_modules/@fullstory/react-native" + FBReactNativeSpec: + :path: "../node_modules/react-native/React/FBReactNativeSpec" glog: :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" hermes-engine: @@ -2585,8 +2586,8 @@ SPEC CHECKSUMS: SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Turf: 13d1a92d969ca0311bbc26e8356cca178ce95da2 VisionCamera: 3033e0dd5272d46e97bcb406adea4ae0e6907abf - Yoga: 1b901a6d6eeba4e8a2e8f308f708691cdb5db312 + Yoga: 64cd2a583ead952b0315d5135bf39e053ae9be70 PODFILE CHECKSUM: a25a81f2b50270f0c0bd0aff2e2ebe4d0b4ec06d -COCOAPODS: 1.14.3 +COCOAPODS: 1.13.0 From c079b78db5a83f87b9364b6885a4ddccc2d7908a Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 25 Apr 2024 12:13:20 +0700 Subject: [PATCH 5/7] fix: es languages --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 7e9b11a4d70d..87ee1ccfb23d 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -228,7 +228,7 @@ export default { enterMerchant: 'Introduce un comerciante', enterAmount: 'Introduce un importe', enterDate: 'Introduce una fecha', - invalidTimeRange: 'Introduzca una hora utilizando el formato de reloj de 12 horas (por ejemplo, 2:30PM).', + invalidTimeRange: 'Por favor, introduce una hora entre 1 y 12 (por ejemplo, 2:30 PM).', }, comma: 'la coma', semicolon: 'el punto y coma', From 08b194178398322aeb2684f28174c9ab4eb5cdd8 Mon Sep 17 00:00:00 2001 From: nkdengineer <161821005+nkdengineer@users.noreply.github.com> Date: Thu, 25 Apr 2024 18:41:39 +0700 Subject: [PATCH 6/7] Update src/components/TimePicker/TimePicker.tsx Co-authored-by: DylanDylann <141406735+DylanDylann@users.noreply.github.com> --- src/components/TimePicker/TimePicker.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TimePicker/TimePicker.tsx b/src/components/TimePicker/TimePicker.tsx index 2cac08b42716..6bfdddaeb212 100644 --- a/src/components/TimePicker/TimePicker.tsx +++ b/src/components/TimePicker/TimePicker.tsx @@ -534,7 +534,7 @@ function TimePicker({defaultValue = '', onSubmit, onInputChange = () => {}}: Tim ) : ( From 9248646e87b5e913c3ef1eff76775e9f7efaf0ce Mon Sep 17 00:00:00 2001 From: nkdengineer <161821005+nkdengineer@users.noreply.github.com> Date: Thu, 25 Apr 2024 18:41:46 +0700 Subject: [PATCH 7/7] Update src/libs/DateUtils.ts Co-authored-by: DylanDylann <141406735+DylanDylann@users.noreply.github.com> --- src/libs/DateUtils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/DateUtils.ts b/src/libs/DateUtils.ts index b44deb5f0434..bef1368f9c2a 100644 --- a/src/libs/DateUtils.ts +++ b/src/libs/DateUtils.ts @@ -662,7 +662,6 @@ function areDatesIdentical(dateTimeStringFirst: string, dateTimeStringSecond: st const isTimeAtLeastOneMinuteInFuture = ({timeString, dateTimeString}: {timeString?: string; dateTimeString: string}): boolean => { let dateToCheck = dateTimeString; if (timeString) { - // return false; dateToCheck = combineDateAndTime(timeString, dateTimeString); }