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:
parent
5f902a55fe
commit
da67aba2d4
@ -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')
|
||||
};
|
||||
}
|
||||
|
@ -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]);
|
||||
|
Loading…
Reference in New Issue
Block a user