浏览代码

Numeric sort rather then alphanumeric

salvoscala 11 年之前
父节点
当前提交
73dd2bca0f
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/common/View.js

+ 5 - 1
src/common/View.js

@@ -800,7 +800,7 @@ function View(calendar) {
 				var segmentCellLast = cellOffsetToCell(segmentCellOffsetLast);
 
 				// view might be RTL, so order by leftmost column
-				var cols = [ segmentCellFirst.col, segmentCellLast.col ].sort();
+				var cols = [ segmentCellFirst.col, segmentCellLast.col ].sort(numericSort);
 
 				// Determine if segment's first/last cell is the beginning/end of the date range.
 				// We need to compare "day offset" because "cell offsets" are often ambiguous and
@@ -860,6 +860,10 @@ function View(calendar) {
 		return range.end.diff(range.start, 'days') > 1;
 	}
 
+	function numericSort(a, b) {
+		return a-b;
+	}
+
 }