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] Submit Expense-Allow location is not shown if device time is set to 7 days in the future #50594

Closed
4 of 6 tasks
IuliiaHerets opened this issue Oct 10, 2024 · 9 comments
Closed
4 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Oct 10, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.0.47-1
Reproducible in staging?: Y
Reproducible in production?: Y
Issue was found when executing this PR: #48237
Issue reported by: Applause Internal Team

Action Performed:

  1. Sign in to the staging New.expensify app.
  2. Click FAB > Submit expense > Select scan tab
  3. Upload a receipt > Select a participant > Submit
  4. Select Not now in allow location modal, the expense should submit
  5. Repeat step 2 & 3 and verify allow location modal is not shown again
  6. Change the device time to one week in the future
  7. Repeat steps 2 & 3 and verify allow location modal IS shown

Expected Result:

"Allow location" modal is shown when submitting expense if the device time is set to one week in the future

Actual Result:

"Allow location" modal is not shown when submitting expense, if the device time is set to 7 days in the future. It is shown, if the device time is set to 8+ days in the future.

Workaround:

Unknown

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6630930_1728578631029.Allow_location_modal.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021847038773485635214
  • Upwork Job ID: 1847038773485635214
  • Last Price Increase: 2024-10-17
Issue OwnerCurrent Issue Owner: @hoangzinh
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 10, 2024
Copy link

melvin-bot bot commented Oct 10, 2024

Triggered auto assignment to @VictoriaExpensify (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.

@IuliiaHerets
Copy link
Author

@VictoriaExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@IuliiaHerets IuliiaHerets changed the title Web - Submit Expense-Allow location is not shown if device time is set to 7 days in the future Submit Expense-Allow location is not shown if device time is set to 7 days in the future Oct 10, 2024
@truph01
Copy link
Contributor

truph01 commented Oct 11, 2024

Edited by proposal-police: This proposal was edited at 2024-10-11 02:45:02 UTC.

Proposal

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

"Allow location" modal is not shown when submitting expense, if the device time is set to 7 days in the future. It is shown, if the device time is set to 8+ days in the future.

What is the root cause of that problem?

  • We use getDifferenceInDaysFromNow to get the difference days from now, where fractional days are truncated towards zero:

DateUtils.getDifferenceInDaysFromNow(new Date(lastLocationPermissionPrompt ?? '')) > CONST.IOU.LOCATION_PERMISSION_PROMPT_THRESHOLD_DAYS);

App/src/libs/DateUtils.ts

Lines 834 to 836 in 4c90d62

function getDifferenceInDaysFromNow(date: Date) {
return differenceInDays(new Date(), date);
}

so differenceInDays(new Date('2024-10-11T09:58:02.872Z'), new Date('2024-10-04T08:58:02.872Z')) is just 7 days.

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

  • Introduce util:
function is7daysFromNow(date: Date) {
    return differenceInMilliseconds(new Date(), date) > 7 * 24 * 60 * 60 * 1000
}
  • Then it will be:
                   DateUtils.is7daysFromNow(new Date(lastLocationPermissionPrompt ?? ''))

What alternative solutions did you explore? (Optional)

@VictoriaExpensify
Copy link
Contributor

Oh I think this issue has already been reported, let me check

@VictoriaExpensify
Copy link
Contributor

Hmm it's similar but not exact - #50042

Checking to see if the solution for that ^^ will resolve this issue

@melvin-bot melvin-bot bot added the Overdue label Oct 16, 2024
Copy link

melvin-bot bot commented Oct 17, 2024

@VictoriaExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

@VictoriaExpensify VictoriaExpensify added the External Added to denote the issue can be worked on by a contributor label Oct 17, 2024
@melvin-bot melvin-bot bot changed the title Submit Expense-Allow location is not shown if device time is set to 7 days in the future [$250] Submit Expense-Allow location is not shown if device time is set to 7 days in the future Oct 17, 2024
Copy link

melvin-bot bot commented Oct 17, 2024

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

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

melvin-bot bot commented Oct 17, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Oct 17, 2024
@VictoriaExpensify VictoriaExpensify removed the External Added to denote the issue can be worked on by a contributor label Oct 17, 2024
@VictoriaExpensify
Copy link
Contributor

Sorry, I'm just re-reading this issue - this sounds extremely niche. I can't think of any good reason someone would set the time on their device to 7 days in the future. I don't think we should put effort into fixing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

4 participants