Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

[NG] Bug Fix for Datepicker in Reactive Forms #2097

Conversation

adibwoy
Copy link
Contributor

@adibwoy adibwoy commented Mar 20, 2018

Fixes: #2093

The initial value set by the user in Reactive Forms wasn't being processed by the Date Picker. Fixes that issue. For more details see #2093

Tested on Chrome

Signed-off-by: Aditya Bhandari adityab@vmware.com

@adibwoy adibwoy self-assigned this Mar 20, 2018
@adibwoy adibwoy requested review from Shijir and youdz March 20, 2018 23:05
@adibwoy adibwoy force-pushed the topic/aditya/datepicker-reactive-form-fixes branch from 8ee1e54 to 6ef816c Compare March 20, 2018 23:10
if (date) {
this._dateNavigationService.selectedDay =
new DayModel(date.getFullYear(), date.getMonth(), date.getDate());
this.writeDateStrToInputField(this._ngControl.value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot of code duplication with processUserDateObject(). It's actually the same method, but processUserDateObject() starts by converting the Date object to a string, then does exactly the same as this.

Please rewrite these two methods so that they share the common code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@youdz: done.

Copy link
Contributor

@Shijir Shijir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Fixes: vmware-archive#2093
Signed-off-by: Aditya Bhandari <adityab@vmware.com>
@adibwoy adibwoy force-pushed the topic/aditya/datepicker-reactive-form-fixes branch from 6d1bf78 to 8faa67f Compare March 21, 2018 22:53
@adibwoy adibwoy added this to the 0.11.10 milestone Mar 22, 2018
@adibwoy adibwoy merged commit b3d0e8d into vmware-archive:master Mar 22, 2018
@adibwoy adibwoy deleted the topic/aditya/datepicker-reactive-form-fixes branch March 22, 2018 13:12
@adibwoy adibwoy removed the In Review label Mar 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants