Slimpicker日期问题与格式

时间:2012-12-18 09:00:30

标签: javascript slimpicker

我安装了这个slimpicker,我正在使用它。

这个想法是: 我对今年的选择有疑问,如果我选择2012年我会得到类似的东西: DD / MM / 112

如果我选择2013,虽然我得到: DD / MM / 2013

这很奇怪。 这是js的数据:

dayChars: 1,
        monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
        dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
        daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], // Leap year is added later
        format: 'mm/dd/yyyy',                                          // How the output looks after selection
        yearStart: (new Date().getFullYear()),                     // Default starting year for dropdown options is 5 years ago
        yearRange: 10,                                                 // Show a 10 year span
        yearOrder: 'asc',                                              // Counting up in years
        startDay: 7                       // 1 = week starts on Monday, 7 = week starts on Sunday
    },

1 个答案:

答案 0 :(得分:2)

在slimpicker.js中搜索代码如下

//日历上显示的日期

this.currentYear = this.calendarYear = this.current.getYear();
this.currentMonth = this.calendarMonth = this.current.getMonth();
this.currentDay = this.current.getDate();

并将其更改为

//日历上显示的日期

this.currentYear = this.calendarYear = this.current.getFullYear();
this.currentMonth = this.calendarMonth = this.current.getMonth();
this.currentDay = this.current.getDate();