Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
[4.2.0] bug: ion-datetime does not displays the correct date if set programatically (e.g. using reactive forms or by [ngModel] prop) #17977
Steps to reproduce:
referenced this issue
Apr 5, 2019
I'm facing this same issue.
Two unexpected things happen:
These are unexpected to me because I didn't specify a timezone for the date I passed to the ion-datetime. I expect the component to display the date as I passed it and to return the picked date in the same format I first passed (YYYY-MM-DD) without timezone changes from what is displayed.
Also, if I do pass a date with timezone I would expect ion-datetime to do these conversions for me.
I don't know if this behavior would fit better as an option for the component to use either no timezone or user timezone.
I made a repo that reproduces this bug. It has a text input that passes its string value to an ion-datetime and another text input that shows the value output by the ion-datetime.
Thanks for additional info. I can confirm that this is a bug.
It's technically correct as the JS Date implementation assumes
I will work on getting a fix in for this. As an (odd) workaround, adding a single space after your input appears to fix the issue.