AngularStrap datepicker doesn't work when the date is typed (keyboard input)

944 Views Asked by At

I have an issue with the AngularStrap datepicker (bs-datepicker directive)..

When a date is selected using the popup datepicker - no problem.

When a date is typed (keyboard) and if the input dateformat is different from the config, the model doesn't get updated. I am not sure if this is how its supposed to work but I am sure the users wont mind just typing in the date instead of using the mouse clicks to select a date.

here is my html

<div class="control-group input-append">
  <input type="text" ng-model="datepicker.date" data-date-format="dd/mm/yyyy" bs-datepicker>
  <button type="button" class="btn" data-toggle="datepicker"><i class="icon-calendar"></i></button>
</div>

User types in 01/01/1998 - no problem.

User types in 01-01-1998 - doesnt work, the model doesnt get updated.

Here is the plunker

Any help is appreciated. The work around I could think of is to make the the input readonly but thats a bad idea.

Thanks in advance.

0

There are 0 best solutions below