0

I have multiple tabs in my application (i.e. I have used ngRoute to navigate to different tabs) and in one of the tab, I have used Angular UI datepicker

<input readonly="true" require id="dateField" type="text" placeholder="DD/MM/YYYY" show-button-bar="false" class="form-control" datepicker-popup="dd/MM/yyyy" ng-model="userData.dob" is-open="opened1" min-date="minDate" max-date="'22/06/2015'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" />

When I click on above input box, I can see usual Angular UI bootstrap calender popup and I am able to select the date.

Once I select the date from datepicker I get the date in 'dd/mm/yyyy' format and I am showing this date in View.

Then I navigate to other tab and come back to my original tab , then the date present input box is shown like "Wed Aug 05 2015 00:00:00 GMT+0530 (India Standard Time)" instead of earlier dd/MM/yyyy format

Is there anything wrong in my code ? Please guid me through. Thanks in advance !

user1608841
  • 2,455
  • 1
  • 27
  • 40
  • 1
    Make sure when you come second time on same tab your format is correctly in your desired format i.e. 'dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'. You can also pass it through controller using array dynamically. Check out [this](https://angular-ui.github.io/bootstrap/) also you can use [angular-moment](https://github.com/urish/angular-moment) to handle it more easily. – road2victory Sep 09 '15 at 06:05
  • try setting init-date parameter – SerhatCan Sep 09 '15 at 06:07

0 Answers0