The Angularjs Bootstrap datepicker is amazing. But I face a problem when I try to select the date by javascript. For example, If read this data from a particular object, 4/5/1990, how can I make the datepicker selected date as that date: 4/5/1990 ?
Hint: I need this when I make data available for user for edit.
Take a look at my current code:
HTML
<input type="text" class="form-control" ng-model="Birthdate" id="Birthdate" name="Birthdate" required autocomplete="on" datepicker-popup="dd/MM/yyyy" is-open="opened" max-date="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)"
ng-required="true" close-text="Close" placeholder="Enter Birthdate" />
js
$scope.Birthdate = $scope.users[id].Birthdate;
But the selected date appears in two cases:
First case: In case the date is 4/5/1986, it swap day and month of the date format. i.e: 4/5/1990 ---becomes---> 5/4/1990
Second case: no date is selected in case of this date: 28/5/1986
Please help me to select the date in the datepicker as I read it from the object, if it is 4/51990, the datepicker selected date should be exactly that date with no mess. And in case I have this date 28/5/1986, the datepicker should stick/be selecting that date.