moment-2.8 compatibility, source (2.0), .add() calls

This commit is contained in:
Adam Shaw
2014-08-06 17:54:02 -07:00
parent b2201620a9
commit 45ead5712f
12 changed files with 30 additions and 30 deletions
+4 -4
View File
@@ -15,14 +15,14 @@ function MonthView(element, calendar) {
function incrementDate(date, delta) {
return date.clone().stripTime().add('months', delta).startOf('month');
return date.clone().stripTime().add(delta, 'months').startOf('month');
}
function render(date) {
t.intervalStart = date.clone().stripTime().startOf('month');
t.intervalEnd = t.intervalStart.clone().add('months', 1);
t.intervalEnd = t.intervalStart.clone().add(1, 'months');
t.start = t.intervalStart.clone();
t.start = t.skipHiddenDays(t.start); // move past the first week if no visible days
@@ -31,14 +31,14 @@ function MonthView(element, calendar) {
t.end = t.intervalEnd.clone();
t.end = t.skipHiddenDays(t.end, -1, true); // move in from the last week if no visible days
t.end.add('days', (7 - t.end.weekday()) % 7); // move to end of week if not already
t.end.add((7 - t.end.weekday()) % 7, 'days'); // move to end of week if not already
t.end = t.skipHiddenDays(t.end, -1, true); // move in from the last invisible days of the week
var rowCnt = Math.ceil( // need to ceil in case there are hidden days
t.end.diff(t.start, 'weeks', true) // returnfloat=true
);
if (t.opt('weekMode') == 'fixed') {
t.end.add('weeks', 6 - rowCnt);
t.end.add(6 - rowCnt, 'weeks');
rowCnt = 6;
}