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

Fix issue where the date displayed by mat-datepicker was one day off from what was specified in the JSON #308

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

albertjke
Copy link

Fix issue where the date displayed by mat-datepicker was one day off from what was specified in the JSON

PR Type

What changes does this PR include (check all that apply)?
[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build process changes
[ ] Documentation changes
[ ] Other... please describe:

Related issue / current behavior

The date displayed by mat-datepicker is one day off from the data in the JSON.

For example:

  1. Navigate to Angular JSON Schema Form — Demonstration Playground
  2. Set the birthday property in the Input JSON Schema Form Layout section to "1999-07-21"
  3. Observe that in the Generated Form section, the birthday displayed is "07/20/1999"

Notice that this is not an issue for the other design frameworks, which correctly display "07/21/1999".

New behavior

Date displayed in the generated mat-datepicker matches the data in the JSON.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Any other relevant information

At first, thought it was an issue with timezones and mat-datepicker (e.g. here). However, it appears that the functions in date.functions.ts were all working correctly to avoid timezone issues.

Found that when the second matInput in the material-datepicker-widget component was used (the one with *ngIf="!boundControl"), this issue did not come up.

Concluded that the reason this issue still exists is because although the dateValue property is computed correctly, it's not being used in the first matInput (the one with *ngIf="boundControl").

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

Successfully merging this pull request may close these issues.

None yet

1 participant