Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[$250] Don't set the user's timezone if it's empty #47452

Closed
puneetlath opened this issue Aug 14, 2024 · 39 comments
Closed

[$250] Don't set the user's timezone if it's empty #47452

puneetlath opened this issue Aug 14, 2024 · 39 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@puneetlath
Copy link
Contributor

puneetlath commented Aug 14, 2024

It seems like there are some cases where the user's local timezone can be empty. In those cases, if the user has "automatic" set for their timezone preferences, we will call the API with the empty timezone. We recently had an employee experience this while using airplane wifi. Coming from the internal issue:

Although, the ideal solution would be to figure out if automatic timezone selection can ever set the selected timezone to empty. I feel like the ideal experience should be no and it should continue to use the previous timezone until a new timezone is obtained. So with an example, if carlos was flying from iceland to new york, while in flight instead of automatic timezone clearing the timezone it should keep it as iceland throughout the flight instead of setting it empty.
So i believe the code change would be here i.e., to if (timezone?.automatic && timezone?.selected !== currentTimezone && currentTimezone !== '') {. I haven't tested nor do i know how to reproduce the issue (i can attempt to reproduce the issue during my flight to savannah 😛). Let me know your thoughts?

Let's try to:

  1. understand what the scenarios are when the currentTimezone would be empty
  2. not call the server to update the timezone in that scenario and instead leave it as-is

cc @rafecolton @chiragsalian

Issue OwnerCurrent Issue Owner: @
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021841911357137490129
  • Upwork Job ID: 1841911357137490129
  • Last Price Increase: 2024-10-03
@puneetlath puneetlath added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 14, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 14, 2024
Copy link

melvin-bot bot commented Aug 14, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External)

Copy link

melvin-bot bot commented Aug 14, 2024

Current assignee @puneetlath is eligible for the Bug assigner, not assigning anyone new.

@FitseTLT
Copy link
Contributor

FitseTLT commented Aug 14, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Don't set the user's timezone if it's empty

What is the root cause of that problem?

We updateAutomaticTimezone if there is a difference between the local timezone and user preferences if automatic is set without checking if the local timezone is not empty

if (timezone?.automatic && timezone?.selected !== currentTimezone) {

What changes do you think we should make in order to solve the problem?

We need to add a check that currentTimezone is not empty

 if(timezone?.automatic && timezone?.selected !== currentTimezone && !!currentTimezone)

What alternative solutions did you explore? (Optional)

Copy link
Contributor

Elliot-Alderson504 Your proposal will be dismissed because you did not follow the proposal template.

@daledah
Copy link
Contributor

daledah commented Aug 15, 2024

Edited by proposal-police: This proposal was edited at 2024-08-15 02:04:16 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

What is the root cause of that problem?

What changes do you think we should make in order to solve the problem?

  • We need to make sure we don't call the server to update the timezone if Intl.DateTimeFormat().resolvedOptions().timeZone is empty and instead leave it as-is.

  • So we need to update:

    if (timezone?.automatic && timezone?.selected !== currentTimezone) {

    to:

        if (!isEmpty(currentTimezone) && timezone?.automatic && timezone?.selected !== currentTimezone) {
            selected: isAutomatic && !isEmpty(currentTimezone) ? currentTimezone : timezone.selected,

with:

        const currentTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone as SelectedTimezone;

What alternative solutions did you explore? (Optional)

  • We can early return in here:
    const formatedTimezone = DateUtils.formatToSupportedTimezone(timezone);

    if formatedTimezone.automatic && isEmpty(formatedTimezone.selected)

@daledah
Copy link
Contributor

daledah commented Aug 15, 2024

Proposal Updated

@wildan-m
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Do not assign a timezone to the user if it is empty.

What is the root cause of that problem?

Intl.DateTimeFormat().resolvedOptions().timeZone can return empty timezone depending on each platform implementation, it might also specific browser bug e.g. this chrome issue.

What changes do you think we should make in order to solve the problem?

In updateAutomaticTimezone function, early return.

src/libs/actions/PersonalDetails.ts

function updateAutomaticTimezone(timezone: Timezone) {
    if (!currentUserAccountID) {
        return;
    }

    if(isEmpty(timezone) || isEmpty(timezone.selected)) {
        return;
    }

What alternative solutions did you explore? (Optional)

N/A

Copy link

melvin-bot bot commented Aug 20, 2024

@puneetlath, @chiragsalian, @abdulrahuman5196 Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot added the Overdue label Aug 20, 2024
@puneetlath
Copy link
Contributor Author

@abdulrahuman5196 thoughts on the proposals?

@abdulrahuman5196
Copy link
Contributor

Checking now

@melvin-bot melvin-bot bot removed the Overdue label Aug 21, 2024
@abdulrahuman5196
Copy link
Contributor

Contributors, I don't see solid information on the first point in all the proposals.

understand what the scenarios are when the currentTimezone would be empty

Furthermore currentTimezone is not optional value and doesn't have empty options - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions#timezone.

Could you folks kindly check and update the proposal on
Then why are we getting empty value?
Or is there some other issue?

And @puneetlath Do we have any way to repro this issue normally?

@puneetlath
Copy link
Contributor Author

The person who experienced it was on airplane wifi when they experienced it. I don't know a way to reliably reproduce it.

Copy link

melvin-bot bot commented Aug 26, 2024

@puneetlath, @chiragsalian, @abdulrahuman5196 Huh... This is 4 days overdue. Who can take care of this?

Copy link

melvin-bot bot commented Aug 28, 2024

@puneetlath @chiragsalian @abdulrahuman5196 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

Copy link

melvin-bot bot commented Aug 28, 2024

@puneetlath, @chiragsalian, @abdulrahuman5196 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@chiragsalian
Copy link
Contributor

Not overdue, waiting for proposals. Demoting to weekly.

@chiragsalian chiragsalian added Weekly KSv2 and removed Daily KSv2 labels Aug 28, 2024
@melvin-bot melvin-bot bot removed the Overdue label Aug 28, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 4, 2024
@daledah
Copy link
Contributor

daledah commented Sep 4, 2024

@abdulrahuman5196 PR is ready.

@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Sep 27, 2024
Copy link

melvin-bot bot commented Sep 27, 2024

This issue has not been updated in over 15 days. @puneetlath, @Beamanator, @chiragsalian, @abdulrahuman5196, @daledah eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@daledah
Copy link
Contributor

daledah commented Sep 28, 2024

PR has been on prod since 18/9/2024

@abdulrahuman5196
Copy link
Contributor

@chiragsalian / @puneetlath Seems the automation had failed here. The PR has been in production for more than a week.

The issue should be due for payment.

@abdulrahuman5196
Copy link
Contributor

The PR that introduced the bug has been identified. Link to the PR:
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:
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:

Not a regression

Determine if we should create a regression test for this bug.
If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

Not a consistently reproducible bug, so regression test wont be useful here.

@mallenexpensify mallenexpensify added Daily KSv2 Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. and removed Reviewing Has a PR in review Monthly KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 3, 2024
Copy link

melvin-bot bot commented Oct 3, 2024

Triggered auto assignment to @strepanier03 (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@mallenexpensify mallenexpensify added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Oct 3, 2024
@melvin-bot melvin-bot bot changed the title Don't set the user's timezone if it's empty [$250] Don't set the user's timezone if it's empty Oct 3, 2024
Copy link

melvin-bot bot commented Oct 3, 2024

Job added to Upwork: https://www.upwork.com/jobs/~021841911357137490129

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 3, 2024
Copy link

melvin-bot bot commented Oct 3, 2024

Current assignee @abdulrahuman5196 is eligible for the External assigner, not assigning anyone new.

@mallenexpensify
Copy link
Contributor

Contributor: @daledah owed $250 via Upwork
Contributor : @abdulrahuman5196 due $250 via NewDot

@daledah , can you please accept the job and reply here once you have?
https://www.upwork.com/jobs/~021841911357137490129

Not a consistently reproducible bug,

@abdulrahuman5196 , can you expand on this? We have an option to test monthly for edgecase bugs, which we might want to do here.

@abdulrahuman5196
Copy link
Contributor

can you expand on this? We have an option to test monthly for edgecase bugs, which we might want to do here.

@mallenexpensify This would be fine. I think the test case would already be in regression test. Anyways added the test steps if required.

  1. Go to Profile > Timezone
  2. Switch to manual timezone
  3. Select another timezone
  4. Switch back to automatic timezone
  5. Verify that: The timezone is updated, no error appears

@JmillsExpensify
Copy link

$250 approved for @abdulrahuman5196

@daledah
Copy link
Contributor

daledah commented Oct 4, 2024

@daledah , can you please accept the job and reply here once you have?

@mallenexpensify I accepted, thanks 🙏

@puneetlath
Copy link
Contributor Author

Thanks for stepping in here @mallenexpensify. I've gone ahead and paid @daledah so we're good to go here. Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
No open projects
Status: No status
Development

No branches or pull requests

10 participants