You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As with the date picker, you should be able to bind to a string value and have the component recognize it's not a string and do an internal conversion.
What is actually happening?
Error: Uncaught (in promise): TypeError: this._value.getHours is not a function
TypeError: this._value.getHours is not a function
at TimeHolder.set [as value] (time-holder.ts:73)
at TimeHolder.setValue (time-holder.ts:89)
at NzTimePickerPanelComponent.writeValue (nz-time-picker-panel.component.ts:496)
The control does not work and the resulting binding is not updated.
Environment
Info
ng-zorro-antd
8.5.2
Browser
Chrome
In our example, we have a model that is generated from a REST API. We cannot control the model, or change it to convert fields to Date instead of a string. On the generated class there will be fields whose times need to be set. There may not be one field, but multiple (in an ngFor for example).
These are standard ISO format strings as seen in the example. On first glance, binding to the control looks to be working. But as soon as you attempt to change the time things break which is unexpected.
Reproduction link
https://stackblitz.com/edit/angular-acn5ao
Steps to reproduce
Bind an
nz-time-picker
to a proper string variable.The initial binding works perfectly.
Trying to change the time throws errors and does not work.
time: string = '2020-02-12T18:16:55.6674440 02:00';
What is expected?
As with the date picker, you should be able to bind to a string value and have the component recognize it's not a string and do an internal conversion.
What is actually happening?
The control does not work and the resulting binding is not updated.
In our example, we have a model that is generated from a REST API. We cannot control the model, or change it to convert fields to
Date
instead of a string. On the generated class there will be fields whose times need to be set. There may not be one field, but multiple (in an ngFor for example).These are standard ISO format strings as seen in the example. On first glance, binding to the control looks to be working. But as soon as you attempt to change the time things break which is unexpected.
Note that binding to a string works for the date picker (https://stackblitz.com/edit/angular-srcksz).
The text was updated successfully, but these errors were encountered: