From 9d613d11e75fe4814879d1cd286f6ae95700ce02 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Wed, 30 Sep 2015 04:12:16 +0000 Subject: [PATCH] CRM-17303 Fix to ensure you cannot schedule Mailings for in the past jshint fixes --- ang/crmUi.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ang/crmUi.js b/ang/crmUi.js index b5c76b2c3d..ac2fc74aa3 100644 --- a/ang/crmUi.js +++ b/ang/crmUi.js @@ -88,6 +88,20 @@ requiredLength = 8; } ngModel.$setValidity('incompleteDateTime', !($(this).val().length && $(this).val().length !== requiredLength)); + var d = new Date(), + month = '' + (d.getMonth() + 1), + day = '' + d.getDate(), + year = d.getFullYear(); + if (month.length < 2) month = '0' + month; + if (day.length < 2) day = '0' + day; + currentDate = [year, month, day].join('-'); + ngModel.$setValidity('dateTimeInThePast', !($(this).val().length && $(this).val() < currentDate)); + if ($(this).val().length && $(this).val() < currentDate){ + crmUiAlert({ + text: ts('The Scheulded date and time is in the past'), + title: ts('Error') + }); + } }); } }; -- 2.25.1