5

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.

1 Answer 1

12

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! it helps! How do I know which one is JQuery wrapper or where they are from in AngularUI?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.