From c91b4af435099f8bb0496359bb3070e09ff28115 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 24 Nov 2015 17:21:37 +0000 Subject: [PATCH] Make sure listview start & end dates stay valid --- calendar/js/app.js | 24 +++++++++++++++++++++++- calendar/templates/default/list.xet | 4 ++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/calendar/js/app.js b/calendar/js/app.js index e9d2498bbf..6e801e5f30 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -1592,7 +1592,11 @@ app.classes.calendar = AppJS.extend( delete state.date; delete state.first; delete state.last; - + delete state.startdate; + delete state.enddate; + delete state.start_date; + delete state.end_date; + return state; }, @@ -1895,11 +1899,19 @@ app.classes.calendar = AppJS.extend( if(state.state.view === 'listview') { state.state.startdate = state.state.date; + if(state.state.startdate.toJSON) + { + state.state.startdate = state.state.startdate.toJSON(); + } if(state.state.end_date) { state.state.enddate = state.state.end_date; } + if(state.state.enddate && state.state.enddate.toJSON) + { + state.state.enddate = state.state.enddate.toJSON(); + } state.state.col_filter = {participant: state.state.owner}; state.state.search = state.state.keywords; @@ -1908,6 +1920,16 @@ app.classes.calendar = AppJS.extend( delete state.state.filter; var nm = view.etemplates[0].widgetContainer.getWidgetById('nm'); + + // 'Custom' filter needs an end date + if(nm.activeFilters.filter === 'custom' && !state.state.end_date) + { + state.state.enddate = state.state.last; + } + if(state.state.enddate && state.state.startdate && state.state.startdate > state.state.enddate) + { + state.state.enddate = state.state.startdate; + } nm.applyFilters(state.state); if(!state.state.end_date && nm.activeFilters.enddate) { diff --git a/calendar/templates/default/list.xet b/calendar/templates/default/list.xet index 05571e8915..e209394ae6 100644 --- a/calendar/templates/default/list.xet +++ b/calendar/templates/default/list.xet @@ -5,9 +5,9 @@