@atombender/hydrant-api
Advanced tools
Comparing version 0.0.32 to 0.0.33
@@ -33,3 +33,9 @@ 'use strict'; | ||
value: function getRange() { | ||
return this.fn(); | ||
var timeZone = arguments[0] === undefined ? null : arguments[0]; | ||
if (timeZone) { | ||
return this.fn(_moment2['default'].tz(timeZone)); | ||
} else { | ||
return this.fn((0, _moment2['default'])()); | ||
} | ||
} | ||
@@ -49,24 +55,24 @@ }, { | ||
return null; | ||
}), new Timeframe('last_hour', 'Last hour', function () { | ||
return _moment2['default'].range((0, _moment2['default'])().startOf('hour'), (0, _moment2['default'])()); | ||
}), new Timeframe('today', 'Today', function () { | ||
return _moment2['default'].range((0, _moment2['default'])().startOf('day'), (0, _moment2['default'])()); | ||
}), new Timeframe('yesterday', 'Yesterday', function () { | ||
return _moment2['default'].range((0, _moment2['default'])().startOf('day').subtract(1, 'days'), (0, _moment2['default'])().startOf('day')); | ||
}), new Timeframe('this_week', 'This week to date', function () { | ||
return _moment2['default'].range((0, _moment2['default'])().startOf('week'), (0, _moment2['default'])()); | ||
}), new Timeframe('last_week', 'Last week', function () { | ||
return _moment2['default'].range((0, _moment2['default'])().startOf('week').subtract(1, 'weeks'), (0, _moment2['default'])().startOf('week')); | ||
}), new Timeframe('last_2_weeks', 'Last 2 weeks', function () { | ||
return _moment2['default'].range((0, _moment2['default'])().startOf('day').subtract(2, 'weeks'), (0, _moment2['default'])()); | ||
}), new Timeframe('last_4_weeks', 'Last 4 weeks', function () { | ||
return _moment2['default'].range((0, _moment2['default'])().startOf('day').subtract(4, 'weeks'), (0, _moment2['default'])()); | ||
}), new Timeframe('this_month', 'This month to date', function () { | ||
return _moment2['default'].range((0, _moment2['default'])().startOf('month'), (0, _moment2['default'])()); | ||
}), new Timeframe('last_month', 'Last month', function () { | ||
return _moment2['default'].range((0, _moment2['default'])().startOf('month').subtract(1, 'months'), (0, _moment2['default'])().startOf('month')); | ||
}), new Timeframe('this_year', 'This year to date', function () { | ||
return _moment2['default'].range((0, _moment2['default'])().startOf('year'), (0, _moment2['default'])()); | ||
}), new Timeframe('last_year', 'Last year', function () { | ||
return _moment2['default'].range((0, _moment2['default'])().startOf('year').subtract(1, 'year'), (0, _moment2['default'])().startOf('year')); | ||
}), new Timeframe('last_hour', 'Last hour', function (now) { | ||
return _moment2['default'].range(now.startOf('hour'), now); | ||
}), new Timeframe('today', 'Today', function (now) { | ||
return _moment2['default'].range(now.startOf('day'), now); | ||
}), new Timeframe('yesterday', 'Yesterday', function (now) { | ||
return _moment2['default'].range(now.startOf('day').subtract(1, 'days'), now.startOf('day')); | ||
}), new Timeframe('this_week', 'This week to date', function (now) { | ||
return _moment2['default'].range(now.startOf('week'), now); | ||
}), new Timeframe('last_week', 'Last week', function (now) { | ||
return _moment2['default'].range(now.startOf('week').subtract(1, 'weeks'), now.startOf('week')); | ||
}), new Timeframe('last_2_weeks', 'Last 2 weeks', function (now) { | ||
return _moment2['default'].range(now.startOf('day').subtract(2, 'weeks'), now); | ||
}), new Timeframe('last_4_weeks', 'Last 4 weeks', function (now) { | ||
return _moment2['default'].range(now.startOf('day').subtract(4, 'weeks'), now); | ||
}), new Timeframe('this_month', 'This month to date', function (now) { | ||
return _moment2['default'].range(now.startOf('month'), now); | ||
}), new Timeframe('last_month', 'Last month', function (now) { | ||
return _moment2['default'].range(now.startOf('month').subtract(1, 'months'), now.startOf('month')); | ||
}), new Timeframe('this_year', 'This year to date', function (now) { | ||
return _moment2['default'].range(now.startOf('year'), now); | ||
}), new Timeframe('last_year', 'Last year', function (now) { | ||
return _moment2['default'].range(now.startOf('year').subtract(1, 'year'), now.startOf('year')); | ||
})]; | ||
@@ -112,1 +118,2 @@ | ||
exports.TIME_INTERVALS = TIME_INTERVALS; | ||
/* now */ |
{ | ||
"name": "@atombender/hydrant-api", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"repository": { | ||
@@ -23,2 +23,3 @@ "type": "git", | ||
"moment-range": ">=1.0.9, <2.0", | ||
"moment-timezone": "^0.5.4", | ||
"underscore": ">=1.7.0" | ||
@@ -25,0 +26,0 @@ }, |
123077
21
3232
7
+ Addedmoment-timezone@^0.5.4
+ Addedmoment-timezone@0.5.46(transitive)