From 1effe5852e7d9312debc6ecb6de334b605bc9fb6 Mon Sep 17 00:00:00 2001 From: Gianni Chiappetta Date: Tue, 1 Mar 2016 16:29:42 -0500 Subject: [PATCH] Version bump to 2.2.0 --- dist/moment-range.js | 19 +++++++++++++++++++ dist/moment-range.min.js | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/dist/moment-range.js b/dist/moment-range.js index bc1cb16..8e70965 100644 --- a/dist/moment-range.js +++ b/dist/moment-range.js @@ -195,6 +195,25 @@ DateRange.prototype.subtract = function(other) { } }; +/** + * Build a n array of dates. + * + * @param {(!DateRange|String)} range Date range to be used for iteration or + * shorthand string (shorthands: + * http://momentjs.com/docs/#/manipulating/add/) + * @param {!boolean} exclusive Indicate that the end of the range should not + * be included in the iter. + * + * @return {!Array} + */ +DateRange.prototype.toArray = function(by, exclusive) { + var acc = []; + this.by(by, function(unit) { + acc.push(unit); + }, exclusive); + return acc; +}; + /** * Iterate over the date range by a given date range, executing a function * for each sub-range. diff --git a/dist/moment-range.min.js b/dist/moment-range.min.js index 0b47788..2e8b60e 100644 --- a/dist/moment-range.min.js +++ b/dist/moment-range.min.js @@ -1 +1 @@ -!function(a,b){"function"==typeof define&&define.amd?define(["moment"],function(c){return a.DateRange=b(c)}):"object"==typeof exports?module.exports=b(require("moment")):a.DateRange=b(moment)}(this,function(a){function b(b,c){var d,e=b,f=c;(1===arguments.length||void 0===c)&&("object"==typeof b&&2===b.length?(e=b[0],f=b[1]):"string"==typeof b&&(d=b.split("/"),e=d[0],f=d[1])),this.start=a(null===e?-864e13:e),this.end=a(null===f?864e13:f)}function c(b,c,d){for(var e=a(this.start);this.contains(e,d);)c.call(this,e.clone()),e.add(1,b)}function d(b,c,d){var e=this/b,f=Math.floor(e);if(f!==1/0){f===e&&d&&f--;for(var g=0;f>=g;g++)c.call(this,a(this.start.valueOf()+b.valueOf()*g))}}var e={year:!0,month:!0,week:!0,day:!0,hour:!0,minute:!0,second:!0};return b.prototype.constructor=b,b.prototype.clone=function(){return a().range(this.start,this.end)},b.prototype.contains=function(a,c){var d=this.start,e=this.end;return a instanceof b?d<=a.start&&(e>a.end||e.isSame(a.end)&&!c):a>=d&&(e>a||e.isSame(a)&&!c)},b.prototype.overlaps=function(a){return null!==this.intersect(a)},b.prototype.intersect=function(a){var c=this.start,d=this.end;return c<=a.start&&a.start=c&&dc&&d<=a.end?[]:a.start<=c&&c=g;g++)c.call(this,a(this.start.valueOf()+b.valueOf()*g))}}var e={year:!0,month:!0,week:!0,day:!0,hour:!0,minute:!0,second:!0};return b.prototype.constructor=b,b.prototype.clone=function(){return a().range(this.start,this.end)},b.prototype.contains=function(a,c){var d=this.start,e=this.end;return a instanceof b?d<=a.start&&(e>a.end||e.isSame(a.end)&&!c):a>=d&&(e>a||e.isSame(a)&&!c)},b.prototype.overlaps=function(a){return null!==this.intersect(a)},b.prototype.intersect=function(a){var c=this.start,d=this.end;return c<=a.start&&a.start=c&&dc&&d<=a.end?[]:a.start<=c&&c