javascript - how do I format date when using pikaday -
i using pikaday module datepicker, format comes inappropriate format. tried adding line of code still not working:
.config(['pikadayconfigprovider', function (pikaday) { pikaday.setconfig({ numberofmonths: 1, format: "yyyy/mm/dd" }); }])
this how html looks like:
<div class="modal-body"> <form role="form"> <div class="form-group"> <input type="text" class="form-control" pikaday="mypickerobject" name="time" ng-model="clas.class_.time" placeholder="enter time" tabindex="3"> </div> </form> </div>
also tried add inline attribute
format = "yyyy/mm/dd"
still not working.
any help
you can use moment.js , set format setting
defaultdate : moment().format("mmm yyyy")
this initial input date display format. displaying/processing date in other desired formats, use
var field = document.getelementbyid('datepicker'); var picker = new pikaday({ onselect: function(date) { field.value = this.getmoment().format('do mmmm yyyy'); } });
Comments
Post a Comment