From: Coleman Watts Date: Mon, 10 Mar 2014 19:19:25 +0000 (-0400) Subject: CRM-14065 - Only compare date not time for activity status warning X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9d0247a05844e4f7250775ec9c1b923f9fa4a706;p=civicrm-core.git CRM-14065 - Only compare date not time for activity status warning --- diff --git a/templates/CRM/Activity/Form/ActivityJs.tpl b/templates/CRM/Activity/Form/ActivityJs.tpl index 8ee7da8284..971f6dd14e 100644 --- a/templates/CRM/Activity/Form/ActivityJs.tpl +++ b/templates/CRM/Activity/Form/ActivityJs.tpl @@ -70,21 +70,19 @@ /** * Function to check activity status in relavent to activity date * - * @param element message JSON object. + * @param message JSON object. */ function activityStatus(message) { - var date = cj("#activity_date_time_display").datepicker('getDate'); - if (date) { + var activityDate = cj("#activity_date_time_display").datepicker('getDate'); + if (activityDate) { var - now = new Date(), - time = cj("#activity_date_time_time").timeEntry('getTime') || date, - activityStatusId = cj('#status_id').val(), - d = date.toString().split(' '), - activityDate = new Date(d[0] + ' ' + d[1] + ' ' + d[2] + ' ' + d[3] + ' ' + time.toTimeString()); - if (activityStatusId == 2 && now < activityDate) { + // Ignore time, only compare dates + today = new Date().setHours(0,0,0,0), + activityStatusId = cj('#status_id').val(); + if (activityStatusId == 2 && today < activityDate) { return confirm(message.completed); } - else if (activityStatusId == 1 && now >= activityDate) { + else if (activityStatusId == 1 && today > activityDate) { return confirm(message.scheduled); } }