From: Seamus Lee Date: Wed, 31 Aug 2016 23:40:25 +0000 (+1000) Subject: CRM-19290 Fix date creation in Karma test X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=74d064bcc3f7b02140d30883259cc55c45178e8f;p=civicrm-core.git CRM-19290 Fix date creation in Karma test --- 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;