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

Bug: TimePickerInput set to dirty on load #1435

Open
zacharyjorn opened this issue Jun 28, 2023 · 0 comments
Open

Bug: TimePickerInput set to dirty on load #1435

zacharyjorn opened this issue Jun 28, 2023 · 0 comments
Labels

Comments

@zacharyjorn
Copy link
Collaborator

Describe the bug
When loading a time picker input that already has a value on it, the form will immediately be marked as dirty.

To Reproduce
Steps to reproduce the behavior:

  1. Create a time picker input and give it a default value that isnt blank.
  2. After loading the form view the dirty state and it should be set to dirty

Expected behavior
When loading a form with a time-picker that has a default value the form should not be marked as dirty until a change is made on the form.

Actual behavior
When loading a form with a time-picker that has a default value the form is marked as dirty before a change was made on the form.

Additional context
I believe the issue is in the method dispatchOnChange in the TimePickerInput.ts file. Here we are comparing the set value to the newValue and if they are not the same then we fire off an event to change/write the value. This is getting set off when the form loads which is fine but the problem lies when comparing the 2 values as they appear to never be equal no matter what. I think here we should be comparing minutes and hours values instead of the whole date value since I think the millisecond on the date variables is causing the comparison check to always fail even if the hours and minutes are matching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants