Jquery Codrops Calendario - 将默认日期格式从YYYY / MM / DD更改为YYYY / MM / DD HH / MM

时间:2015-12-06 21:10:18

标签: jquery

我有源代码:

_getBody:function(){

        var d = new Date( this.year, this.month + 1, 0 ),
            // number of days in the month
            monthLength = d.getDate(),
            firstDay = new Date( this.year, this.month, 1 );

        // day of the week
        this.startingDay = firstDay.getDay();

        var html = '<div class="fc-body"><div class="fc-row">',
            // fill in the days
            day = 1;

        // this loop is for weeks (rows)
        for ( var i = 0; i < 7; i++ ) {

            // this loop is for weekdays (cells)
            for ( var j = 0; j <= 6; j++ ) {

                var pos = this.startingDay - this.options.startIn,
                    p = pos < 0 ? 6 + pos + 1 : pos,
                    inner = '',
                    today = this.month === this.today.getMonth() && this.year === this.today.getFullYear() && day === this.today.getDate(),
                    content = '';

                if ( day <= monthLength && ( i > 0 || j >= p ) ) {

                    inner += '<span class="fc-date">' + day + '</span><span class="fc-weekday">' + this.options.weekabbrs[ j + this.options.startIn > 6 ? j + this.options.startIn - 6 - 1 : j + this.options.startIn ] + '</span>';

                    // this day is:
                    var strdate = ( this.year ) + '/' + ( this.month + 1 < 10 ? '/' + ( this.month + 1 ) : this.month + 1 ) + '/' + ( day < 10 ? '0' + day : day ) ,
                        dayData = this.caldata[ strdate ];

                    if( dayData ) {
                        content = dayData;
                    }

                    if( content !== '' ) {
                        inner += '<div>' + content + '</div>';
                    }

                    ++day;

                }
                else {
                    today = false;
                }

                var cellClasses = today ? 'fc-today ' : '';
                if( content !== '' ) {
                    cellClasses += 'fc-content';
                }

                html += cellClasses !== '' ? '<div class="' + cellClasses + '">' : '<div>';
                html += inner;
                html += '</div>';

            }

格式数据:YYYY / MM / DD

var codropsEvents = {     &#39;十二分之二千零一十五/ 24#39; :&#39; asd&#39; };

但对我来说需要YYYY / MM / DD HH:mm

var codropsEvents = {     &#39; 2015/12/24 19:00&#39; :&#39; asd&#39; };

不显示该时间但脚本有效。

1 个答案:

答案 0 :(得分:0)

//这一天是:                     var strdate =(this.year)+'/'+(this.month + 1&lt; 10?'/'+(this.month + 1):this.month + 1)+'/'+(day&lt; 10?'0'+日:每天),                         dayData = this.caldata [strdate];

此代码回答格式数据