From 74d064bcc3f7b02140d30883259cc55c45178e8f Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Thu, 1 Sep 2016 09:40:25 +1000 Subject: [PATCH] CRM-19290 Fix date creation in Karma test --- tests/karma/unit/crmMailingRadioDateSpec.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/karma/unit/crmMailingRadioDateSpec.js b/tests/karma/unit/crmMailingRadioDateSpec.js index defda31a03..279f331bbe 100644 --- a/tests/karma/unit/crmMailingRadioDateSpec.js +++ b/tests/karma/unit/crmMailingRadioDateSpec.js @@ -87,8 +87,18 @@ describe('crmMailingRadioDate', function() { expect(element.find('.crm-form-time').timeEntry('getTime').getMinutes()).toBe(3); var now = new Date(); - var month = '' + (now.getMonth() + 1); - var day = '' + (now.getDate() + 1); + var month = ''; + var day = ''; + if (now.getMonth() == 12) { + month = '1'; + } else { + month = month + (now.getMonth() + 1); + } + if (now.getDate() >= 28) { + day = '1'; + } else { + day = day + (now.getDate() + 1); + } var year = (now.getFullYear() + 1); if (day.length < 2) day = '0' + day; if (month.length < 2) month = '0' + month; -- 2.25.1