-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Reopened/Feature: Remove moment from datepicker #29984
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
Reopened/Feature: Remove moment from datepicker #29984
Conversation
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
|
@allroundexperts 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] |
|
@allroundexperts could you please tests especially the cases which were caught in staging before? |
|
@waterim Conflicts. |
|
@allroundexperts resolved! |
|
@allroundexperts bump for a checklist, thanks! |
|
Conflicts again. |
|
@allroundexperts |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-10-13.at.2.40.48.AM.movMobile Web - ChromeScreen.Recording.2023-10-13.at.2.46.48.AM.movMobile Web - SafariScreen.Recording.2023-10-13.at.2.44.49.AM.movDesktopScreen.Recording.2023-10-13.at.2.52.13.AM.moviOSScreen.Recording.2023-10-13.at.2.45.34.AM.movAndroidScreen.Recording.2023-10-13.at.2.47.55.AM.mov |
allroundexperts
left a comment
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 well!
Screen.Recording.2023-10-31.at.11.34.07.AM.mov
mountiny
left a comment
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.
Thanks guys! 🚀
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.95-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.95-9 🚀
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.96-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.96-15 🚀
|
| const hasAvailableDatesNextMonth = startOfDay(endOfMonth(new Date(this.props.maxDate))) > addMonths(new Date(this.state.currentDateView), 1); | ||
| const hasAvailableDatesPrevMonth = startOfDay(new Date(this.props.minDate)) < endOfMonth(subMonths(new Date(this.state.currentDateView), 1)); |
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.
We should have the same logic here. This caused a regression #31793
| const isAfterMaxDate = currentDate > startOfDay(new Date(this.props.maxDate)); | ||
| const isDisabled = !day || isBeforeMinDate || isAfterMaxDate; | ||
| const isSelected = moment(this.props.value).isSame(moment([currentYearView, currentMonthView, day]), 'day'); | ||
| const isSelected = isSameDay(new Date(this.props.value), new Date(currentYearView, currentMonthView, day)); |
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.
In moment if we pass a null day we will get an invalid date but this is not the case with Date. This lead to a regression #31793.
moment([2000, 1, null]).format() // 'Invalid date'
new Date(2000, 1, null) // Mon Jan 31 2000 00:00:00 GMT+0100 (Central European Standard Time)| } | ||
|
|
||
| let currentDateView = moment(props.value, CONST.DATE.MOMENT_FORMAT_STRING).toDate(); | ||
| let currentDateView = new Date(props.value); |
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.
There was another instance of date being fetched incorrectly on this line.
When props.value type is 'YYYY-MM-DD' and user timezone is behind UTC, the previous date is returned.
parseISO should have been used like others.
Details
This PR is to remove moment from Datepicker
Fixed Issues
$ #19810
Tests
Offline tests
Same as tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.