当前位置: 动力学知识库 > 问答 > 编程问答 >

momentjs - Pikaday format does not work despite including moment.js

问题描述:

I am using the Pikaday Data Picker. I am unable to override the default format to MM/DD/YYYY. I have included the Pikaday library and Moment.js but it still does not work.

<input id="datepicker" type="text" />

var picker = new Pikaday(

{

field: document.getElementById('datepicker'),

format : "MM/DD/YYYY",

firstDay: 1,

minDate: new Date('2000-01-01'),

maxDate: new Date(),

yearRange: [2000,2020]

});

Here is my fiddle:

http://jsfiddle.net/gfinzer/t046bqm2/2/

网友答案:

You are including moment.js after Pikaday — it needs to be the other way around.

<script type="application/javascript" src="moment.js"></script>
<script type="application/javascript" src="pikaday.js"></script>

(this code block is only here, because SO otherwise won't let me post the link to JSFiddle without it)

Updated example: http://jsfiddle.net/janfoeh/t046bqm2/3/

分享给朋友:
您可能感兴趣的文章:
随机阅读: