jquery DatePicker - 数字月份下拉列表

时间:2012-11-29 17:17:45

标签: javascript jquery date dom datepicker

我的datepicker有一个HTML输入元素......很正常

<input type="text" id="from_date">

允许月/年更改的非常正常的设置

$('#from_date').datepicker({
    dateFormat: "mm/yy",
    changeMonth: true,
    changeYear: true
});

但是月份下拉列表显示的名称如“Jan”而不是“1”或“01”

如何将下拉值更改为数字表示?

1 个答案:

答案 0 :(得分:10)

在此检查datepicker选项: http://api.jqueryui.com/datepicker/

$('#from_date').datepicker({
    dateFormat: "mm/yy",
    changeMonth: true,
    changeYear: true,
    monthNames: ["1","2","3","4","5","6","7","8","9","10","11","12"],
    monthNamesShort: ["1","2","3","4","5","6","7","8","9","10","11","12"]
});

这可能是一个解决方案。