Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc6cd91b

Browse files
authored
OBPIH-7556 Screen goes blank after adding row with exp date in cycle count in es_mx locale (#5599)
1 parent0f7ce3b commitc6cd91b

File tree

5 files changed

+46
-6
lines changed

5 files changed

+46
-6
lines changed

‎src/js/consts/locale.js‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
exportconstLocale={
2+
AR:'ar',
3+
ACH:'ach',
4+
DE:'de',
5+
EN:'en',
6+
ES:'es',
7+
ES_MX:'es_MX',
8+
FR:'fr',
9+
HT:'ht',
10+
IT:'IT',
11+
PT:'pt',
12+
FI:'fi',
13+
ZH:'zh',
14+
};
15+
16+
// Used for mapping locales between libraries that are not supporting codes like es_MX
17+
exportconstLocaleConverter={
18+
...Locale,
19+
ES_MX:'es',
20+
};

‎src/js/hooks/cycleCount/useCountStep.jsx‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ import _ from 'lodash';
1212
importqueryStringfrom'query-string';
1313
import{useDispatch,useSelector}from'react-redux';
1414
import{useHistory}from'react-router-dom';
15-
import{getCurrentLocation,getCycleCountRequestIds}from'selectors';
15+
import{
16+
getCurrentLocale,
17+
getCurrentLocation,
18+
getCurrentUser,
19+
getCycleCountRequestIds,
20+
}from'selectors';
1621

1722
import{
1823
eraseDraft,
@@ -71,10 +76,12 @@ const useCountStep = () => {
7176
cycleCountIds,
7277
currentLocation,
7378
currentUser,
79+
locale,
7480
}=useSelector((state)=>({
7581
cycleCountIds:getCycleCountRequestIds(state),
7682
currentLocation:getCurrentLocation(state),
77-
currentUser:state.session.user,
83+
currentUser:getCurrentUser(state),
84+
locale:getCurrentLocale(state),
7885
}));
7986

8087
constshowBinLocation=useMemo(()=>
@@ -337,7 +344,9 @@ const useCountStep = () => {
337344
product:cycleCountItem.product?.id,
338345
expirationDate:dateWithoutTimeZone({
339346
date:cycleCountItem?.inventoryItem?.expirationDate,
347+
currentDateFormat:DateFormat.MMM_DD_YYYY,
340348
outputDateFormat:DateFormat.MM_DD_YYYY,
349+
locale,
341350
}),
342351
},
343352
cycleCount:cycleCountItem.cycleCountId,

‎src/js/hooks/cycleCount/useResolveStep.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import moment from 'moment';
1414
import{useDispatch,useSelector}from'react-redux';
1515
import{useHistory}from'react-router-dom';
1616
import{
17+
getCurrentLocale,
1718
getCurrentLocation,
19+
getCurrentUser,
1820
getCycleCountsIds,
1921
getReasonCodes,
2022
getUsers,
@@ -80,12 +82,14 @@ const useResolveStep = () => {
8082
reasonCodes,
8183
users,
8284
currentUser,
85+
locale,
8386
}=useSelector((state)=>({
8487
users:getUsers(state),
8588
cycleCountIds:getCycleCountsIds(state),
8689
reasonCodes:getReasonCodes(state),
8790
currentLocation:getCurrentLocation(state),
88-
currentUser:state.session.user,
91+
currentUser:getCurrentUser(state),
92+
locale:getCurrentLocale(state),
8993
}));
9094

9195
consttranslate=useTranslate();
@@ -535,6 +539,7 @@ const useResolveStep = () => {
535539
date:cycleCountItem?.inventoryItem?.expirationDate,
536540
currentDateFormat:DateFormat.MMM_DD_YYYY,
537541
outputDateFormat:DateFormat.MM_DD_YYYY,
542+
locale,
538543
}),
539544
},
540545
binLocation:cycleCountItem?.binLocation,

‎src/js/hooks/useFormatNumber.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import{useSelector}from'react-redux';
22
import{getCurrentLocale}from'selectors';
33

4+
import{Locale,LocaleConverter}from'consts/locale';
5+
46
constuseFormatNumber=()=>{
57
constcurrentLocale=useSelector(getCurrentLocale);
68

7-
return(value,locale=currentLocale||'en-US')=>
8-
newIntl.NumberFormat(locale).format(value);
9+
return(value,locale=currentLocale||Locale.EN)=>{
10+
constnormalizedLocale=LocaleConverter[locale?.toUpperCase?.()]||locale;
11+
12+
returnnewIntl.NumberFormat(normalizedLocale).format(value);
13+
};
914
};
1015

1116
exportdefaultuseFormatNumber;

‎src/js/utils/dateUtils.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ const dateWithoutTimeZone = ({
1616
date,
1717
currentDateFormat,
1818
outputDateFormat=DateFormat.MM_DD_YYYY,
19+
locale='en',
1920
})=>{
2021
if(!date){
2122
returnnull;
2223
}
2324

2425
constparsedDate=currentDateFormat
25-
?moment(date,currentDateFormat).utcOffset(0,true)
26+
?moment(date,currentDateFormat,locale).utcOffset(0,true)
2627
:moment(date).utcOffset(0,true);
2728
returnparsedDate.format(outputDateFormat);
2829
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp