Any way to get angular -ui-bootstrap date picker to accept multiple formats for dates?

Using the latest version of angular -ui-bootstrap and the date picker directive to make my date picker, but what I would like to know is if you have the choice to choose two different formats for the text box.

<input type="text" class="form-control" ng-model="vm.startDate" uib-datepicker-popup="M/d/yyyy" datepicker-options="vm.dateOptions" close-text="Close" is-open="vm.opened1" placeholder="Start Date" ng-required="false" min-date="vm.minDate" max-date="vm.maxDate" init-date="vm.getCalendarInitDate()" /> 

uib-datepicker-popup = "M / d / yyyy" is great for dates like 9/5/2015, but what about the one who puts 9/5/15? This does not work.

Ideally, I would like both of them to be acceptable.

Any ideas?

+5
source share
1 answer

It seems that the problem (at least for days and months) has been fixed with commit . Now you can define the day / month / year-date in the format d!.M!.yyyy . It allows an optional leading zero for the day and month. See github-issue for more details.

+5
source

Source: https://habr.com/ru/post/1233731/


All Articles