First, I would like to thank and congratulate the team for your work, Clarity is a pretty cool library.
[x] bug
[ ] feature request
[ ] enhancement
I have an object with an existing date attribute in it, and I want it to be modified
<input type="date" name="dateToModify" [(ngModel)]="myObject.date">
I expect to show the actual date value and let me change it with the date picker.
When a value already exists, the value don't appear in the input field. It only appears once I set it.
Angular version: 4.0.1
Clarity version: 0.9.0
OS and version: Linux Ubuntu 16.04
Browser: Chrome 57
Hi @samdidos,
This is an Angular2 issue, not Clarity related. Many reports can be found on the topic.
The cleanest and easiest solution I've seen so far is to change the binding like this:
`<input type="date" [ngModel]="myDate | date:'yyyy-MM-dd'"
(ngModelChange)="myDate = $event">`
Otherwise you have to manually parse the date you want to preset to the yyyy-MM-dd format, as the Angular component only recognises this format, not the generic Date object.
Thanks @Jinnie For answering this. 馃槃
@Jinnie Thank you for the tip!
It works, thanks a lot! Can you help me on another similar matter? I would like the Clarity date picker to show the date in format "dd/mm/yyyy" instead of the default format "mm/dd/yyyy", is that possible?
@samdidos : There is no datepicker component in Clarity (yet). See #474
What you are likely seeing is the built-in Chrome datepicker that is tied to the date inputs.
See MDN article for more info on that
Ok thx a lot @mathisscott I haven't realised that!
@Jinnie Thanks alot!
Try this. Working fine
[(ngModel)]="admissionDetail.startDate">
Hi there 馃憢, this is an automated message. To help Clarity keep track of discussions, we automatically lock closed issues after 14 days. Please look for another open issue or open a new issue with updated details and reference this one as necessary.
Most helpful comment
Hi @samdidos,
This is an Angular2 issue, not Clarity related. Many reports can be found on the topic.
The cleanest and easiest solution I've seen so far is to change the binding like this:
Otherwise you have to manually parse the date you want to preset to the yyyy-MM-dd format, as the Angular component only recognises this format, not the generic Date object.