Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/libs/DateUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import moment from 'moment-timezone';
import lodashGet from 'lodash/get';

// IMPORTANT: load any locales (other than english) that might be passed to moment.locale()
import 'moment/locale/es';
Expand All @@ -10,11 +11,11 @@ import CONST from '../CONST';
import {translate} from './translate';
import * as PersonalDetails from './actions/PersonalDetails';

let timezone;
let timezone = CONST.DEFAULT_TIME_ZONE;
Onyx.connect({
key: ONYXKEYS.MY_PERSONAL_DETAILS,
callback: (val) => {
timezone = val ? val.timezone : CONST.DEFAULT_TIME_ZONE;
timezone = lodashGet(val, 'timezone', CONST.DEFAULT_TIME_ZONE);
},
});

Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/AppNavigator/AuthScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class AuthScreens extends React.Component {
returnValueList: 'nameValuePairs',
nvpNames: ONYXKEYS.NVP_PREFERRED_LOCALE,
}).then((response) => {
const preferredLocale = response.nameValuePairs.preferredLocale || CONST.DEFAULT_LOCALE;
const preferredLocale = lodashGet(response, ['nameValuePairs', 'preferredLocale'], CONST.DEFAULT_LOCALE);
if ((currentPreferredLocale !== CONST.DEFAULT_LOCALE) && (preferredLocale !== currentPreferredLocale)) {
setLocale(currentPreferredLocale);
} else {
Expand Down