3

I am trying to custom the ui.bootstrap.datepicker there http://plnkr.co/edit/?p=preview

I would like to set the format to dd-MM-yy and make it work with the input with the mask (the second one below 'Popup' in the plunkr)

<div class="col-md-6">
            <p class="input-group">
              <input type="date" class="form-control" datepicker-popup ng-model="dt" is-open="opened" min-date="minDate" max-date="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" />
              <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>
        </div>

I have added a new format in script.js :

  $scope.formats = ['dd-MM-yy', 'dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];

Is there a way to change the format of the second datepicker (under 'Popup'), the one with <input type="date"...> ?

Thanks.

user1260928
  • 3,269
  • 9
  • 59
  • 105

1 Answers1

1

HTML5 date input types do not support custom formats. See Is there any way to change input type="date" format? for more information. I think it is better to change input type to text, like the first one.

Community
  • 1
  • 1
alisabzevari
  • 8,008
  • 6
  • 43
  • 67
  • if I do that, only the first datepicker (under 'Popup') has its format changed http://plnkr.co/edit/dGWvB5bHvpeQdGnJQKf2?p=preview – user1260928 Jun 17 '15 at 06:14
  • You asked you want to change format of datepicker of input. What exactly do you want to do? – alisabzevari Jun 17 '15 at 06:18
  • it's ok, I have managed to do what I wanted : allow user to type the date manually with the format dd-MM-yy (http://plnkr.co/edit/fTFNu9Mp2kX5X1D6AJOx?p=preview) – user1260928 Jun 17 '15 at 06:41