js日历表
$scope.getCurrentWeek = function (day) {
var days = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
//定义数组
var week = [];
//获取当前星期X(0-6,0代表星期天)
var index = new Date(day).getDay();
//循环
for (var i = 0; i < 7; i++) {
//当天日期
var tmp = new Date(day);
//设置某一天
tmp.setDate(tmp.getDate() - index + i);
//push:将参数添加到原数组末尾,并返回数组的长度
week.push({ Date: tmp, Day: days[i] });
}
$scope.currentWeek = week;
};