Selaa lähdekoodia

getFallbackDuration

Adam Shaw 9 vuotta sitten
vanhempi
sitoutus
ab3dfb4521
1 muutettua tiedostoa jossa 7 lisäystä ja 2 poistoa
  1. 7 2
      src/common/View.date-range.js

+ 7 - 2
src/common/View.date-range.js

@@ -155,8 +155,8 @@ View.mixin({
 			unit = computeGreatestUnit(range.start, range.end);
 		}
 		else {
-			unit = 'day';
-			duration = moment.duration({ days: 1 });
+			duration = this.getFallbackDuration();
+			unit = computeGreatestUnit(duration);
 			range = this.buildRangeFromDuration(date, direction, duration, unit);
 		}
 
@@ -166,6 +166,11 @@ View.mixin({
 	},
 
 
+	getFallbackDuration: function() {
+		return moment.duration({ days: 1 });
+	},
+
+
 	// If the range has day units or larger, remove times. Otherwise, ensure times.
 	normalizeRange: function(range, unit) {