Skip to content

Commit 2c13e4d

Browse files
committed
fix timezone on profile with new account
Signed-off-by: Nam Le <yentth237@gmail.com>
1 parent 1fac96b commit 2c13e4d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/libs/Navigation/AppNavigator/AuthScreens.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,29 @@ import styles from '../../../styles/styles';
3535
import * as SessionUtils from '../../SessionUtils';
3636
import getNavigationModalCardStyle from '../../../styles/getNavigationModalCardStyles';
3737

38-
let currentUserEmail;
38+
let timezone;
39+
let currentAccountID;
3940
Onyx.connect({
4041
key: ONYXKEYS.SESSION,
4142
callback: (val) => {
42-
// When signed out, val is undefined
43-
if (!val) {
43+
// When signed out, val hasn't accountID
44+
if (!_.has(val, 'accountID')) {
45+
timezone = null;
4446
return;
4547
}
4648

47-
currentUserEmail = val.email;
49+
currentAccountID = val.accountID;
4850
},
4951
});
5052

51-
let timezone;
5253
Onyx.connect({
5354
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
5455
callback: (val) => {
5556
if (!val || timezone) {
5657
return;
5758
}
5859

59-
timezone = lodashGet(val, [currentUserEmail, 'timezone'], {});
60+
timezone = lodashGet(val, [currentAccountID, 'timezone'], {});
6061
const currentTimezone = moment.tz.guess(true);
6162

6263
// If the current timezone is different than the user's timezone, and their timezone is set to automatic

0 commit comments

Comments
 (0)