schedule fixes
This commit is contained in:
1 parent
7e1c33fdda
commit
d7521e5ac5
2 files changed
+8
-11
No files matched your search
@@ -12,6 +12,7 @@
|
|||||||
.schedule{
|
.schedule{
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 30px auto 0 auto;
|
margin: 30px auto 0 auto;
|
||||||
|
padding-bottom: 50px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
table{
|
table{
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ const course = require("../../models/course");
|
|||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
app.controller("ScheduleController", function ($scope, schedule, team) {
|
app.controller("ScheduleController", function ($scope, schedule, team) {
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
var day = now.getDay();
|
var dates = getDates(now);
|
||||||
var dates = getDates(day);
|
|
||||||
|
|
||||||
var sem = "late";
|
var sem = "late";
|
||||||
$scope.sem = [["early", "весеннего"], ["late", "осеннего"]].reduce(function (s, word) {
|
$scope.sem = [["early", "весеннего"], ["late", "осеннего"]].reduce(function (s, word) {
|
||||||
@@ -67,16 +66,13 @@ function range(start, num, step) {
|
|||||||
// return new Date(d.setDate(diff));
|
// return new Date(d.setDate(diff));
|
||||||
//}
|
//}
|
||||||
|
|
||||||
function getDates(day) {
|
function getDates(start) {
|
||||||
var dates = [];
|
var day = start.getDay();
|
||||||
var prev = day == 0 ? 0 : day - 1;
|
return range(0, 6, 1).reduce(function (dates, weekDay) {
|
||||||
var next = 6 - prev;
|
var d = 1 + weekDay - day;
|
||||||
var dayMask = range(-1, prev, -1).concat([0]).concat(range(1, next, 1));
|
var time = start.getTime() + (1000 * 60 * 60 * 24) * d;
|
||||||
|
|
||||||
dayMask.forEach(function (m) {
|
|
||||||
var time = Date.now() + (1000 * 60 * 60 * 24) * m;
|
|
||||||
var date = new Date(time);
|
var date = new Date(time);
|
||||||
dates.push(date.getDate());
|
dates.push(date.getDate());
|
||||||
});
|
|
||||||
return dates;
|
return dates;
|
||||||
|
}, []);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user