Quellcode durchsuchen

default view date alignment to dateIncrement when it is specified

Adam Shaw vor 9 Jahren
Ursprung
Commit
bd2ab7ad2f
2 geänderte Dateien mit 11 neuen und 1 gelöschten Zeilen
  1. 10 1
      src/common/View.date-range.js
  2. 1 0
      tests/automated-better/view-dates/dateIncrement.js

+ 10 - 1
src/common/View.date-range.js

@@ -228,6 +228,8 @@ View.mixin({
 	// `unit` is the already-computed computeGreatestUnit value of duration.
 	buildRangeFromDuration: function(date, direction, duration, unit) {
 		var customAlignment = this.opt('dateAlignment');
+		var customIncrementInput = this.opt('dateIncrement');
+		var customIncrementUnit;
 		var start = date.clone();
 		var end;
 
@@ -239,7 +241,14 @@ View.mixin({
 			}
 		}
 
-		start.startOf(customAlignment || unit);
+		if (customIncrementInput) {
+			customIncrementUnit = computeDurationGreatestUnit(
+				moment.duration(customIncrementInput),
+				customIncrementInput
+			);
+		}
+
+		start.startOf(customAlignment || customIncrementUnit || unit);
 		end = start.clone().add(duration);
 
 		return { start: start, end: end };

+ 1 - 0
tests/automated-better/view-dates/dateIncrement.js

@@ -1,3 +1,4 @@
 /*
 SEE: prev/next
+SEE: dateIncrement tests in fullcalendar-scheduler
 */