1

I am using the bootstrap datepicker for angular but having issues with displaying the correct dateformat. The format I am getting now is: "2015-09-08T00:56:40.272Z". The format I want is dd-mmm-yyyy.

This is my datepicker:

<p class="input-group">

  selected date:{{dt}}

    <input type="text" class="form-control" datepicker-popup="{{format}}" ng-model="dt"
           is-open="opened" datepicker-options="dateOptions"
           date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" my-date/>

              <span class="input-group-btn">

                <button type="button" class="btn btn-default" ng-click="open($event)"><i
                        class="glyphicon glyphicon-calendar"></i></button>

              </span>
</p>

I tried this: Angular bootstrap datepicker date format does not format ng-model value.

But did not fix the issue. How can I get the right dateformat?

plunkr:http://plnkr.co/edit/CbNHCl?p=preview

Community
  • 1
  • 1
Pindakaas
  • 4,389
  • 16
  • 48
  • 83
  • http://stackoverflow.com/questions/24198669/angular-bootsrap-datepicker-date-format-does-not-format-ng-model-value – Fergus Jul 12 '16 at 03:44

1 Answers1

0

Do you mean where you have selected date:{{dt}}? You simply need to format it there using the date filter

selected date:{{dt | date:format}}

This is because your dt model will be a Date instance.

http://plnkr.co/edit/zKWXwb?p=preview

Phil
  • 157,677
  • 23
  • 242
  • 245