-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Awaiting checklist completion] [$500] Request money - Calendar is showing the wrong date #31416
Comments
Triggered auto assignment to @twisterdotcom ( |
Job added to Upwork: https://www.upwork.com/jobs/~0135c08e4c75c14697 |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @0xmiroslav ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Calendar / DatePicker weekdays header is off, ahead by one day. What is the root cause of that problem?Lines 148 to 151 in 5e01376
Code assumes week starts on Monday when rendering the weekdays header (I starts at 0)
While the matrix of days assume it starts on Sunday (technically it checks it ends on Saturday by checking if day == 6 before starting a new week) What changes do you think we should make in order to solve the problem? const startOfCurrentWeek = startOfWeek(new Date(), {weekStartsOn: 0}); // Assuming Sunday is the start of the week
const endOfCurrentWeek = endOfWeek(new Date(), {weekStartsOn: 0}); // Assuming Sunday is the start of the week Update the start of the week to Sunday. Or update the matrix to use Monday as the start date: // Add null values for days before the first day of the month
for (let i = 1; i < getDay(firstDayOfMonth); i++) { // changed starting value for I to 1
currentWeek.push(null);
}
// Start a new row when the current week is full
if (getDay(currentDate) === 0) { // changed to 0
matrix.push(currentWeek);
currentWeek = [];
} This should align both elements of the calendar on when the week starts. Another proposal below if we want to adapt to user's preferences, which might be better as people are used to different things depending on where they are. What alternative solutions did you explore? (Optional)The confusion here is because certain places in the world the week starts on Sunday while others on Monday. The matrix of days always assume Sunday as the start of the day and the header assumes Monday, that's why the disconnect. Another option would be to actually determine what's the first day of the week based on user's locale (
Something like this (code need polishing, just for illustration purposes): let weekStartsOn = 0; // Assuming Sunday is the default start of the week
if (Intl && Intl.Locale) {
const weekInfo = new Intl.Locale(preferredLocale).weekInfo;
if (weekInfo && weekInfo.firstDay) {
weekStartsOn = weekInfo.firstDay === 7 ? 0 : weekInfo.firstDay;
}
} We could also hardcode the rules as the list of available Locales are hardcoded as well with only a few options. Basically We an extract this logic into a function on Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job. |
ProposalPlease re-state the problem that we are trying to solve in this issue.The calendar is inaccurate. The dates are one day ahead. The week on the calendar starts from Monday to Sunday instead of Sunday to Saturday What is the root cause of that problem?In here, we're configuring for the week to start on Monday (1), but when generate the calendar day matrix, we still use utils So for example, first day of November is a Wednesday, and What changes do you think we should make in order to solve the problem?Configure For
And use it in instead of To explain more on that method, if the week starts on Monday, then:
What alternative solutions did you explore? (Optional)The number 6 above seems a bit random because we're assuming Monday. A more general implementation that will work for any
That might be more consistent with our implementation here, we can put 1 to a If we're ok to let the week start on Sunday instead, we can remove the Monday customization here |
I will review the date calculation logic in your code and will ensure that the dates are being calculated accurately. If the dates are consistently one day ahead, there might be an offset in your date calculations. Contributor details |
📣 @techdevelopers08! 📣
|
|
ProposalAdded more details |
I updated the details here |
@techdevelopers08 please complete the task here: #31416 (comment) @0xmiroslav let us know if any of these proposals are good to go today please. |
@twisterdotcom I've updated my contribution details already here. Please update me if I missed anything. |
@techdevelopers08 you must post it as a single comment on its own for our automation to remember it. |
Contributor details |
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
I like @barros001's alternative solution to get the first day of the week from user locale and make it consistent throughout the app. We can fallback to either Sunday or Monday always if some user locale doesn't have that info for some reason. |
Triggered auto assignment to @MonilBhavsar, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Sounds good, let's fall back to Monday as default following the ISO convention -
|
Ah I forgot that we already had conclusion. I will review PR during weekend. Please merge main |
main merged |
@0xmiroslav just checking again on this. |
@0xmiroslav do you think you can review the PR this week? This issue is pretty important IMO and we should try and get this pushed out quickly. |
sorry forgot this. will review today |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.19-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-01-05. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
|
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:
|
Payment Summary:
Awaiting checklist completion from @0xmiroslav now. |
No need regression test because this was reported by QA team and we added automated tests to prevent this bug further. |
Hi @twisterdotcom, according to the discussion here on this issue, I and @barros001 will be sharing compensation, and @barros001 also agreed with it by reacting here Could you send me an Upwork job, thanks! |
@twisterdotcom friendly bump on this, thanks! |
Refund of $250 from @barros001 here. |
@twisterdotcom I was under the impression that @tienifr would get a separate payment instead of splitting the payment?
|
@twisterdotcom I accepted, thanks! |
Apologies @barros001 I am going off the comment you 👍 in Slack here about agreeing to split: https://expensify.slack.com/archives/C01GTK53T8Q/p1700757642008119?thread_ts=1700483443.288289&cid=C01GTK53T8Q If it's a better middle ground, we can also not process the $250 refund and just pay out $250 for @tienifr. |
@twisterdotcom yeah, the conversation was a little vague and not super clear. Ultimately we should do what’s right based on defined internal process (if any) for these cases. If it means I get to keep the full payment, great. If it means I should process the refund, that’s totally fine as well. Just let me know how to proceed and I’ll act accordingly. |
@barros001 made good efforts for making complete PR so it seems not fair to me to split equal compensation between them. So I suggest to cancel refund (just my opinion. Final decision will be from internal team ofc) |
Okay, I'm happy for you to reject the refund request @barros001. Sorry for the confusion. |
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: 1.4.0-0
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:
Expected Result:
The calendar is accurate
Actual Result:
The calendar is inaccurate. The dates are one day ahead. The week on the calendar starts from Monday to Sunday instead of Sunday to Saturday
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6278477_1700100895903.bandicam_2023-11-16_09-41-03-104.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: