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
+2 -2
View File
@@ -15,7 +15,7 @@ function BasicDayView(element, calendar) { // TODO: make a DayView mixin
function incrementDate(date, delta) {
var out = date.clone().stripTime().add('days', delta);
var out = date.clone().stripTime().add(delta, 'days');
out = t.skipHiddenDays(out, delta < 0 ? -1 : 1);
return out;
}
@@ -24,7 +24,7 @@ function BasicDayView(element, calendar) { // TODO: make a DayView mixin
function render(date) {
t.start = t.intervalStart = date.clone().stripTime();
t.end = t.intervalEnd = t.start.clone().add('days', 1);
t.end = t.intervalEnd = t.start.clone().add(1, 'days');
t.title = calendar.formatDate(t.start, t.opt('titleFormat'));
+1 -1
View File
@@ -388,7 +388,7 @@ function BasicView(element, calendar, viewName) {
function defaultSelectionEnd(start) {
return start.clone().stripTime().add('days', 1);
return start.clone().stripTime().add(1, 'days');
}
+2 -2
View File
@@ -15,14 +15,14 @@ function BasicWeekView(element, calendar) { // TODO: do a WeekView mixin
function incrementDate(date, delta) {
return date.clone().stripTime().add('weeks', delta).startOf('week');
return date.clone().stripTime().add(delta, 'weeks').startOf('week');
}
function render(date) {
t.intervalStart = date.clone().stripTime().startOf('week');
t.intervalEnd = t.intervalStart.clone().add('weeks', 1);
t.intervalEnd = t.intervalStart.clone().add(1, 'weeks');
t.start = t.skipHiddenDays(t.intervalStart);
t.end = t.skipHiddenDays(t.intervalEnd, -1, true);
+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;
}