You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C+ Checklist Needs Completion] [$500] Profile - Incorrect city name in automatic timezone selection #30468
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Version Number: 1.3.91-6 Reproducible in staging?: Y
**Reproducible in production?:**Y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal Team Slack conversation:
Action Performed:
Pre-condition: User logged in and located in Ukraine
Type city exactly as in the automatical result "Kiev"
Expected Result:
Name of the city in the manual and automatic time zone selection will be identical
Actual Result:
Name of the city in the automatic timezone selection is Kiev, but if you try to find this timezone manually you can't find anything. Because timezone name in manual selection is Kyiv
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
changed the title [-]Profile - Incorrect city name in automatic timezone selection[/-][+][$500] Profile - Incorrect city name in automatic timezone selection[/+]on Oct 26, 2023
Please re-state the problem that we are trying to solve in this issue.
The relevant timezone is not included in the configured data.
What is the root cause of that problem?
The timezone list is not being updated.
What changes do you think we should make in order to solve the problem?
In JavaScript, you can use the moment-timezone library to get a list of time zones.
To automatically update the timezones.js file with the list of time zones obtained from moment.tz.names(), you have several options. One way is to create a script that dynamically generates the TIMEZONES.js file
When you run this script, it will generate (or update) the TIMEZONES.js file at the specified path. If the moment-timezone library is updated with new time zones, you can re-run this script to automatically update TIMEZONES.js.
Instead of running this script manually, you could also use some automation tool (e.g., a cron job or a CI/CD pipeline) to run it periodically.
example
const fs = require('fs');
const moment = require('moment-timezone');
const timezones = moment.tz.names();
let output = "export default [\n";
for (const tz of timezones) {
output += ` '${tz}',\n`;
}
output += "];\n";
fs.writeFile('path/to/timezones.js', output, (err) => {
if (err) {
console.error('Error writing file:', err);
} else {
console.log('timezones.js has been updated');
}
});
changed the title [-][HOLD for payment 2024-01-17] [$500] Profile - Incorrect city name in automatic timezone selection[/-][+][C+ Checklist Needs Completion] [$500] Profile - Incorrect city name in automatic timezone selection[/+]on Jan 17, 2024
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
[@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
[@sobitneupane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@sobitneupane] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
It is an edge case that was missed while testing the PR.
[@sobitneupane] Determine if we should create a regression test for this bug.
Nope. It was reported by Applause - Internal Team. So, I believe the regression test for this issue is already covered.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
[-]Profile - Incorrect city name in automatic timezone selection[/-][+][$500] Profile - Incorrect city name in automatic timezone selection[/+]melvin-bot commentedon Oct 26, 2023
Triggered auto assignment to @greg-schroeder (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Oct 26, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01bb82fb7cffd6353f
melvin-bot commentedon Oct 26, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Oct 26, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (
External)iiredalert commentedon Oct 26, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
We are unable to find Kiev as a timezone when selecting the time zone manually
What is the root cause of that problem?
Kiev is not defined in TIMEZONES.js, only Kyiv is defined.
What changes do you think we should make in order to solve the problem?
Add 'Europe/Kiev' to TIMEZONES.js
They both are valid names for the city and are valid time zones.
Verified by running this in the javascript console:
What alternative solutions did you explore? (Optional)
ZhenjaHorbach commentedon Oct 26, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Incorrect city name in automatic timezone selection
What is the root cause of that problem?
We use a constant in which the names of the time zones do not match the time zones from the
Intllibraryhttps://github.com/Expensify/App/blob/53699cfa5aae38f8a95859ce102ff026cf9ce407/src/TIMEZONES.js
What changes do you think we should make in order to solve the problem?
I think the easiest way to avoid such problems is
It does not use third party data like this json
App/src/TIMEZONES.js
Line 1 in 53699cf
https://raw.githubusercontent.com/leon-do/Timezones/main/timezone.json
And use time zones from the
Intllibrary because for automatic value we also useIntllibrary (Intl.DateTimeFormat().resolvedOptions().timeZone)App/src/pages/settings/Profile/TimezoneInitialPage.js
Line 39 in 546f27e
For this we can use
Intl.supportedValuesOf('timeZone')method to get all list available timezonesand we can call here instead using TIMEZONES constant
App/src/pages/settings/Profile/TimezoneSelectPage.js
Lines 40 to 49 in 546f27e
As alternative:
We can simply copy the result of this function
Intl.supportedValuesOf('timeZone')And insert instead of the old values
To be sure that the data matches
What alternative solutions did you explore? (Optional)
We can just update zone names in TIMEZONES constants
suneox commentedon Oct 27, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Incorrect city name in automatic timezone selection
What is the root cause of that problem?
The list of timezone is missing from
App/src/TIMEZONES.js
Line 1 in bb32cc5
What changes do you think we should make in order to solve the problem?
We will create timezoneBackwardMap from tz_database
At function getUserTimezone if timezone not exits on TIMEZONES.ts we will get backward link from timezoneBackwardMap
Then At function updateAutomaticTimezone also check if timezone not exits on TIMEZONES.ts we will get backward link from timezoneBackwardMap
What alternative solutions did you explore? (Optional)
girafferz commentedon Oct 27, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
The relevant timezone is not included in the configured data.
What is the root cause of that problem?
The timezone list is not being updated.
What changes do you think we should make in order to solve the problem?
In JavaScript, you can use the moment-timezone library to get a list of time zones.
To automatically update the timezones.js file with the list of time zones obtained from moment.tz.names(), you have several options. One way is to create a script that dynamically generates the TIMEZONES.js file
When you run this script, it will generate (or update) the TIMEZONES.js file at the specified path. If the moment-timezone library is updated with new time zones, you can re-run this script to automatically update TIMEZONES.js.
Instead of running this script manually, you could also use some automation tool (e.g., a cron job or a CI/CD pipeline) to run it periodically.
example
91 remaining items
[-][HOLD for payment 2024-01-17] [$500] Profile - Incorrect city name in automatic timezone selection[/-][+][C+ Checklist Needs Completion] [$500] Profile - Incorrect city name in automatic timezone selection[/+]greg-schroeder commentedon Jan 22, 2024
Bump @sobitneupane :)
greg-schroeder commentedon Jan 25, 2024
Bump again so we can get this one closed out!
sobitneupane commentedon Jan 29, 2024
Sorry for the delay @greg-schroeder I was mostly unavailable last week. I will try to get it done this week (probably tomorrow)
greg-schroeder commentedon Jan 31, 2024
No problem! Thanks Sobit!
sobitneupane commentedon Feb 2, 2024
#24446
This issue is not solely caused by the linked PR. Auto-selecting timezone is returning outdated timezone. Discussion: #30468 (comment) and #30468 (comment)
It is an edge case that was missed while testing the PR.
Nope. It was reported by Applause - Internal Team. So, I believe the regression test for this issue is already covered.
greg-schroeder commentedon Feb 2, 2024
Thanks! closing
JmillsExpensify commentedon Feb 14, 2024
$500 approved for @sobitneupane based on this summary.