forked from fullcalendar/fullcalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasicWeekView.js
42 lines (27 loc) · 1.21 KB
/
BasicWeekView.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* A week view with simple day cells running horizontally
----------------------------------------------------------------------------------------------------------------------*/
// TODO: a WeekView mixin for calculating dates and titles
fcViews.basicWeek = BasicWeekView; // register this view
function BasicWeekView(calendar) {
BasicView.call(this, calendar); // call the super-constructor
}
BasicWeekView.prototype = createObject(BasicView.prototype); // define the super-class
$.extend(BasicWeekView.prototype, {
name: 'basicWeek',
incrementDate: function(date, delta) {
return date.clone().stripTime().add(delta, 'weeks').startOf('week');
},
render: function(date) {
this.intervalStart = date.clone().stripTime().startOf('week');
this.intervalEnd = this.intervalStart.clone().add(1, 'weeks');
this.start = this.skipHiddenDays(this.intervalStart);
this.end = this.skipHiddenDays(this.intervalEnd, -1, true);
this.title = this.calendar.formatRange(
this.start,
this.end.clone().subtract(1), // make inclusive by subtracting 1 ms
this.opt('titleFormat'),
' \u2014 ' // emphasized dash
);
BasicView.prototype.render.call(this, 1, this.getCellsPerWeek(), false); // call the super-method
}
});