From 6c04fca1f3dd69f01c802db365585f0c605fd9b5 Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Mon, 4 Aug 2014 19:08:22 -0700 Subject: [PATCH] moment-2.8 compatibility, source (2.1), .add() calls --- src/agenda/AgendaDayView.js | 4 ++-- src/agenda/AgendaWeekView.js | 4 ++-- src/basic/BasicDayView.js | 4 ++-- src/basic/BasicWeekView.js | 4 ++-- src/basic/MonthView.js | 8 ++++---- src/common/DayGrid.limit.js | 2 +- src/common/View.js | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/agenda/AgendaDayView.js b/src/agenda/AgendaDayView.js index 7dda747..86a9080 100644 --- a/src/agenda/AgendaDayView.js +++ b/src/agenda/AgendaDayView.js @@ -16,7 +16,7 @@ $.extend(AgendaDayView.prototype, { incrementDate: function(date, delta) { - var out = date.clone().stripTime().add('days', delta); + var out = date.clone().stripTime().add(delta, 'days'); out = this.skipHiddenDays(out, delta < 0 ? -1 : 1); return out; }, @@ -25,7 +25,7 @@ $.extend(AgendaDayView.prototype, { render: function(date) { this.start = this.intervalStart = date.clone().stripTime(); - this.end = this.intervalEnd = this.start.clone().add('days', 1); + this.end = this.intervalEnd = this.start.clone().add(1, 'days'); this.title = this.calendar.formatDate(this.start, this.opt('titleFormat')); diff --git a/src/agenda/AgendaWeekView.js b/src/agenda/AgendaWeekView.js index 9d8052c..701ac24 100644 --- a/src/agenda/AgendaWeekView.js +++ b/src/agenda/AgendaWeekView.js @@ -17,14 +17,14 @@ $.extend(AgendaWeekView.prototype, { incrementDate: function(date, delta) { - return date.clone().stripTime().add('weeks', delta).startOf('week'); + 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('weeks', 1); + this.intervalEnd = this.intervalStart.clone().add(1, 'weeks'); this.start = this.skipHiddenDays(this.intervalStart); this.end = this.skipHiddenDays(this.intervalEnd, -1, true); diff --git a/src/basic/BasicDayView.js b/src/basic/BasicDayView.js index c8ac265..feb56b6 100644 --- a/src/basic/BasicDayView.js +++ b/src/basic/BasicDayView.js @@ -16,7 +16,7 @@ $.extend(BasicDayView.prototype, { incrementDate: function(date, delta) { - var out = date.clone().stripTime().add('days', delta); + var out = date.clone().stripTime().add(delta, 'days'); out = this.skipHiddenDays(out, delta < 0 ? -1 : 1); return out; }, @@ -25,7 +25,7 @@ $.extend(BasicDayView.prototype, { render: function(date) { this.start = this.intervalStart = date.clone().stripTime(); - this.end = this.intervalEnd = this.start.clone().add('days', 1); + this.end = this.intervalEnd = this.start.clone().add(1, 'days'); this.title = this.calendar.formatDate(this.start, this.opt('titleFormat')); diff --git a/src/basic/BasicWeekView.js b/src/basic/BasicWeekView.js index 00b3c1c..6416d85 100644 --- a/src/basic/BasicWeekView.js +++ b/src/basic/BasicWeekView.js @@ -17,14 +17,14 @@ $.extend(BasicWeekView.prototype, { incrementDate: function(date, delta) { - return date.clone().stripTime().add('weeks', delta).startOf('week'); + 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('weeks', 1); + this.intervalEnd = this.intervalStart.clone().add(1, 'weeks'); this.start = this.skipHiddenDays(this.intervalStart); this.end = this.skipHiddenDays(this.intervalEnd, -1, true); diff --git a/src/basic/MonthView.js b/src/basic/MonthView.js index 588d57e..56eced6 100644 --- a/src/basic/MonthView.js +++ b/src/basic/MonthView.js @@ -24,7 +24,7 @@ $.extend(MonthView.prototype, { incrementDate: function(date, delta) { - return date.clone().stripTime().add('months', delta).startOf('month'); + return date.clone().stripTime().add(delta, 'months').startOf('month'); }, @@ -32,7 +32,7 @@ $.extend(MonthView.prototype, { var rowCnt; this.intervalStart = date.clone().stripTime().startOf('month'); - this.intervalEnd = this.intervalStart.clone().add('months', 1); + this.intervalEnd = this.intervalStart.clone().add(1, 'months'); this.start = this.intervalStart.clone(); this.start = this.skipHiddenDays(this.start); // move past the first week if no visible days @@ -41,14 +41,14 @@ $.extend(MonthView.prototype, { this.end = this.intervalEnd.clone(); this.end = this.skipHiddenDays(this.end, -1, true); // move in from the last week if no visible days - this.end.add('days', (7 - this.end.weekday()) % 7); // move to end of week if not already + this.end.add((7 - this.end.weekday()) % 7, 'days'); // move to end of week if not already this.end = this.skipHiddenDays(this.end, -1, true); // move in from the last invisible days of the week rowCnt = Math.ceil( // need to ceil in case there are hidden days this.end.diff(this.start, 'weeks', true) // returnfloat=true ); if (this.isFixedWeeks()) { - this.end.add('weeks', 6 - rowCnt); + this.end.add(6 - rowCnt, 'weeks'); rowCnt = 6; } diff --git a/src/common/DayGrid.limit.js b/src/common/DayGrid.limit.js index a3a10bf..60b69df 100644 --- a/src/common/DayGrid.limit.js +++ b/src/common/DayGrid.limit.js @@ -287,7 +287,7 @@ $.extend(DayGrid.prototype, { return seg.event; }); var dayStart = dayDate.clone().stripTime(); - var dayEnd = dayStart.clone().add('days', 1); + var dayEnd = dayStart.clone().add(1, 'days'); return this.eventsToSegs(events, dayStart, dayEnd); }, diff --git a/src/common/View.js b/src/common/View.js index 7081788..cdafdb2 100644 --- a/src/common/View.js +++ b/src/common/View.js @@ -788,14 +788,14 @@ function View(calendar) { // beyond the next day threshold, adjust the end to be the exclusive end of `endDay`. // Otherwise, leaving it as inclusive will cause it to exclude `endDay`. if (endTimeMS && endTimeMS >= nextDayThreshold) { - endDay.add('days', 1); + endDay.add(1, 'days'); } } // If no end was specified, or if it is within `startDay` but not past nextDayThreshold, // assign the default duration of one day. if (!end || endDay <= startDay) { - endDay = startDay.clone().add('days', 1); + endDay = startDay.clone().add(1, 'days'); } return { start: startDay, end: endDay };