0

我在 durandal 项目中工作。我写了这段代码:

$('#leftDatePicker').igDatePicker({

    dateInputFormat: "d-m-yy",
    dateDisplayFormat: "d-m-yy",
    datepickerOptions: {
        minDate: d,  
        yearRange: "2011:2014",
        changeMonth: true,
        changeYear: true
    }
});

由于我添加了属性dateInputFormat: "d-m-yy",,日期选择器显示为我选择了月份数 0!如果我手动更改它,它会留下我输入的新值,而不管日历中的选择。例如:

我选择年份编号 2013、月份 Jun 和日期 4;它显示:2013 年 4 月 0 日。如果我自己写 4-6-2013,然后我选择例如 2014 年、8 月和 2 日,它会显示:2-6-2014,即使 8 月是第 8 个月!它不会更改月份以匹配我的选择。

4

1 回答 1

1

从这些文档中的样子来看,您需要使用大写字母M

"M": month field as digit without leading zero
"MM": month field as digit with leading zero
"MMM": month field as short month name
"MMMM": month field as long month name

小写为分钟:

"m": minutes field without leading zero
"mm": minutes field with leading zero
于 2013-08-19T10:53:48.910 回答