Round date intervals to nearest hour

start_date, stop_date and end will be rounded to the nearest hour, in
order to help cache hits.

Change-Id: I441e8ded715a727362a44f14c24571a37217e0d7
This commit is contained in:
Sean M. Collins 2016-05-24 18:08:08 -07:00
parent e2817570dc
commit 0530b663d1
1 changed files with 7 additions and 3 deletions

View File

@ -24,7 +24,10 @@ var viewService = function($rootScope, $location) {
}
});
var periodEnd = new Date();
var periodEnd = moment()
.startOf('hour')
.add(1,'hours')
.toDate();
var periodOptions = [
moment.duration({ hours: 1 }),
moment.duration({ hours: 12 }),
@ -117,8 +120,9 @@ var viewService = function($rootScope, $location) {
periodStart: function() {
return moment(periodEnd)
.subtract(selectDuration())
.toDate();
.startOf('hour')
.subtract(selectDuration())
.toDate();
},
periodOptions: function() {