File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/components/IncompleteUserProfile Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import PT from 'prop-types'
66import { PROFILE_FIELDS_CONFIG } from '../../config/constants'
77import ProfileSettingsForm from '../../routes/settings/routes/profile/components/ProfileSettingsForm'
88import { getDefaultTopcoderRole } from '../../helpers/permissions'
9+ import { timezones } from 'appirio-tech-react-components/constants/timezones'
910
1011const IncompleteUserProfile = ( {
1112 profileSettings,
@@ -31,7 +32,12 @@ const IncompleteUserProfile = ({
3132 // if time zone is required and doesn't have a value yet,
3233 // then detect timezone using browser feature and prefill the form
3334 if ( fieldsConfig . timeZone && ! profileSettings . settings . timeZone ) {
34- prefilledProfileSettings . settings . timeZone = ( new Intl . DateTimeFormat ( ) ) . resolvedOptions ( ) . timeZone
35+ const autodetectedTimeZone = ( new Intl . DateTimeFormat ( ) ) . resolvedOptions ( ) . timeZone
36+ // only use autodetected timezone if it's on our timezone list, otherwise leave it empty
37+ if ( _ . find ( timezones , { zoneName : autodetectedTimeZone } ) ) {
38+ prefilledProfileSettings . settings . timeZone = autodetectedTimeZone
39+ }
40+ console . log ( 'Auto-detected timezone' , prefilledProfileSettings . settings . timeZone )
3541 }
3642
3743 if ( isTopcoderUser ) {
You can’t perform that action at this time.
0 commit comments