Pikaday calendar date format not working

Viewed 1095

I'm using the Pikaday calendar library but the date format seems to be being ignored. I have this code:

<script>
var picker = new Pikaday(
{
    field: document.getElementById('dayDate'),
    firstDay: 1,
    minDate: new Date(2017, 0, 1),
    maxDate: new Date(2020, 12, 31),
    yearRange: [2017, 2020],
    format: 'YYYY-MM-DD',
    bound: false,
    container: document.getElementById('date-container'),
});
</script>

This outputs the date in this format 'Thu May 25 2017' I need it to be in the format '2017-05-25'. What am I doing wrong?

1 Answers
Related