1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Default dates to today and yesterday

This commit is contained in:
Joe Fiorini 2015-05-29 09:37:07 -04:00
parent 5f902a55fe
commit da67aba2d4
2 changed files with 19 additions and 5 deletions

View File

@ -4,9 +4,23 @@
* All Rights Reserved
*************************************************/
export function searchDateRange(date) {
export function searchDateRange(dateString) {
var date;
switch(dateString) {
case 'yesterday':
date = moment().subtract(1, 'day');
break;
case 'tomorrow':
date = moment().add(1, 'day');
break;
default:
date = moment(dateString);
}
return {
from: moment(date).startOf('day'),
to: moment(date).endOf('day')
from: date.startOf('day'),
to: date.endOf('day')
};
}

View File

@ -21,8 +21,8 @@ export default {
var hostIds = $route.current.params.hosts.split(',');
var moduleParam = $location.search().module || 'packages';
var leftDate = searchDateRange('2015-05-26');
var rightDate = searchDateRange('2015-05-26');
var leftDate = searchDateRange('yesterday');
var rightDate = searchDateRange();
if (hostIds.length === 1) {
hostIds = hostIds.concat(hostIds[0]);