Ver código fonte

remove isWithin

Adam Shaw 9 anos atrás
pai
commit
ee62b66523
2 arquivos alterados com 6 adições e 9 exclusões
  1. 6 2
      src/Calendar.js
  2. 0 7
      src/moment-ext.js

+ 6 - 2
src/Calendar.js

@@ -637,7 +637,10 @@ function Calendar_constructor(element, overrides) {
 			// render or rerender the view
 			if (
 				!currentView.displaying ||
-				!date.isWithin(currentView.intervalStart, currentView.intervalEnd) // implicit date window change
+				!( // NOT within interval range signals an implicit date window change
+					date >= currentView.intervalStart &&
+					date < currentView.intervalEnd
+				)
 			) {
 				if (elementVisible()) {
 
@@ -836,7 +839,8 @@ function Calendar_constructor(element, overrides) {
 
 	function updateTodayButton() {
 		var now = t.getNow();
-		if (now.isWithin(currentView.intervalStart, currentView.intervalEnd)) {
+
+		if (now >= currentView.intervalStart && now < currentView.intervalEnd) {
 			header.disableButton('today');
 		}
 		else {

+ 0 - 7
src/moment-ext.js

@@ -316,13 +316,6 @@ newMomentProto.toISOString = function() {
 // Querying
 // -------------------------------------------------------------------------------------------------
 
-// Is the moment within the specified range? `end` is exclusive.
-// FYI, this method is not a standard Moment method, so always do our enhanced logic.
-newMomentProto.isWithin = function(start, end) {
-	var a = commonlyAmbiguate([ this, start, end ]);
-	return a[0] >= a[1] && a[0] < a[2];
-};
-
 // When isSame is called with units, timezone ambiguity is normalized before the comparison happens.
 // If no units specified, the two moments must be identically the same, with matching ambig flags.
 newMomentProto.isSame = function(input, units) {