I am using pikaday library for my angularjs app for datepicker but can't change the format for the date and my html element looks like this:
<input pikaday="clas.myPicker" class="form-control" on-select="clas.onPikadaySelect(pikaday)">
The format shows as: Aug 30 2016, I would want it 2016-08-30.
I see that I have to use moment.js, I tried this: https://github.com/urish/angular-moment but my angularjs version is 1.2.16 quite old and I cannot install it.
I also have this on the app config in angularjs:
.config(['pikadayConfigProvider', function (pikaday) {
pikaday.setConfig({
// numberOfMonths: 1,
format: "YYYY-MM-DD"
});
}])
Is there any other option how do I change the format of date?
You don't need to use angular-moment.
What you should do is to include momentjs script on your HTML page before you include pickaday.js:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment.min.js"></script>
Like in this example. Pickaday format option will work.