-
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
DateUtils refactor, remove moment from the code, timezone fixes. #24446
DateUtils refactor, remove moment from the code, timezone fixes. #24446
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple comments
@thienlnam Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Doesn't look like the reviewers were linked correctly - updating from the issue |
// IMPORTANT: load any locales (other than english) that might be passed to moment.locale() | ||
import 'moment/locale/es'; | ||
import {zonedTimeToUtc, utcToZonedTime, formatInTimeZone} from 'date-fns-tz'; | ||
import {es, enGB} from 'date-fns/locale'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I love the alternative!
It's 3x smaller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @waterim and everyone who has reviewed this til now. Looking good to me, going to wait for @allroundexperts review and testing
Hi @waterim! Can you please mention clear test steps for this? |
Hey @allroundexperts |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-08-22.at.1.24.57.AM.movMobile Web - ChromeScreen.Recording.2023-08-22.at.1.39.27.AM.movMobile Web - SafariScreen.Recording.2023-08-22.at.1.42.46.AM.movDesktopScreen.Recording.2023-08-22.at.1.31.57.AM.moviOSScreen.Recording.2023-08-22.at.1.43.53.AM.movAndroidScreen.Recording.2023-08-22.at.1.41.31.AM.mov |
@waterim Can you please upload the screen recordings on all the platforms? |
@allroundexperts oh, I see, verifying it rn |
Yep, screenshots should work |
@mountiny your list is correct, as I can see it has full IANA support |
@allroundexperts Not sure if I understand you correctly, but polyfill works correctly, it takes only IANA timezones, meanwhile on web(without polyfill) Intl.supportedValuesOf("timeZone") is taking different standard ECMAScript Internationalization API which is breaking date-fns functions. |
@waterim could you leave a link in the timezones page what is the source so its traceable, thanks! @allroundexperts also ready for another look |
@mountiny Added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working good now. Thanks for the changes @waterim!
🎯 @allroundexperts, thanks for reviewing and testing this PR! 🎉 An E/App issue has been created to issue payment here: #25619. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks everyone!
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.56-2 🚀
|
FYI, a regression was found here: https://expensify.slack.com/archives/C049HHMV9SM/p1692671896444999 |
#25650 issue for above |
Heads up this also caused a regression related to marking things as unread on iOS. Web is unaffected. |
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.56-24 🚀
|
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.58-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.58-5 🚀
|
let todayAt = Localize.translate(locale, 'common.todayAt'); | ||
let tomorrowAt = Localize.translate(locale, 'common.tomorrowAt'); | ||
let yesterdayAt = Localize.translate(locale, 'common.yesterdayAt'); | ||
const at = Localize.translate(locale, 'common.conjunctionAt'); | ||
|
||
const startOfCurrentWeek = startOfWeek(new Date(), {weekStartsOn: 1}); // Assuming Monday is the start of the week | ||
const endOfCurrentWeek = endOfWeek(new Date(), {weekStartsOn: 1}); // Assuming Monday is the start of the week | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This caused regression.
While updating week start day to Monday on header, body still remains as Sunday for the start day
|
||
// If the date is equal to the end of today | ||
if (input.isSame(endOfToday)) { | ||
if (isSameDay(input, endOfToday)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It caused this bug because if we set custom time after 30 minutes, the isSameDay function still returns true
Details
This PR is about refactoring DateUtils and usage of it, removing all moment and timezone configuration.
Fixed Issues
$ #19810
PROPOSAL: #19810 (comment)
Tests
Offline tests
N/A automated tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
N/A automated tests
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android