Example #1
0
 month-name
 prev-month-short-name
 prev-month-name
 next-month-short-name
 next-month-name
 day-name
 day-short-name
 };
 */
var json = { "days": [] };
json["requested-month"] = 6;
json["requested-year"] = 2014;

var date = new xdate(json["requested-year"], json["requested-month"], 1);

json["days-in-month"] = xdate.getDaysInMonth(json["requested-year"], json["requested-month"]);
json["first-day-in-month"] = date.getDay();
json["days-in-calendar"] = ((json["first-day-in-month"] == 0) && (json["days-in-month"] == 28)) ? 28 : 35;

json["month-index"] = date.getMonth();
json["month-name"] = date.toString("MMMM");
json["month-short-name"] = date.toString("MMM");

var nextMonth = date.clone().addMonths(1);
json["next-month-index"] = nextMonth.getMonth();
json["next-month-name"] = nextMonth.toString("MMMM");
json["next-month-short-name"] = nextMonth.toString("MMM");

var prevMonth = date.clone().addMonths(-1);
json["prev-month-index"] = prevMonth.getMonth();
json["prev-month-name"] = prevMonth.toString("MMMM");
Example #2
0
        }).limit(1).exec(function ( err, docs ) {
                if ( err ) return;

                Counter.findOne({
                    type: 'summary',
                    _id : {
                        $lt: Math.floor((new xDate()).setHours(23).setMinutes(59).setSeconds(59).setDate(xDate.getDaysInMonth((new xDate()).getFullYear(),
                            (new xDate()).getMonth())).getTime() / 1000).toString(16) + "0000000000000000"
                    }
                }).sort('_id', -1).limit(1).exec(function ( err, last ) {
                        if ( err ) return;

                        callback(Math.floor((last.get('counter') - docs.get('counter')) * 100) / 100);
                    });
            });