So I have :
<input ng-model="date1" ui-date>
<div ng-model="date2" ui-date></div>
It works great. The div calendar 'date2' will follow the change of its previous ui-date input, namely 'date1' the input box.
AngularUI did a great job, when you have multiple input+div calendars existing in one page, imagine a travel agent booking page, 'date4' will group with 'date3' automatically, 'date6' will group with 'date5' automatically ...etc. well done.
However, in my sample code <input ng-model="date1" ui-date>
only works in US format with back-slash delimiters 'MM/dd/yyyy'.
My question is, how do I change the default input date format? If I want to have iso-8601 'yyyy-MM-dd' as my input, ui-date doesn't seem to recognise it as a valid input.
I tried ui-date="yyyy-MM-dd"
it doesn't seem to have any effects.
Since this is a wrapper for the datepicker in jQueryUI, you should check the document here
You can set it like this
ui-date="{ dateFormat: 'yy-mm-dd' }"
Here is the plunker
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With