diff --git a/control/content/controllers/content.event.controller.js b/control/content/controllers/content.event.controller.js index 76821a8..d61389b 100644 --- a/control/content/controllers/content.event.controller.js +++ b/control/content/controllers/content.event.controller.js @@ -46,7 +46,12 @@ }; ContentEvent.isValidEvent = function (event) { - balanceDateTime() + + if ((+new Date(event.startTime) >= +new Date(event.endTime))) { + ContentEvent.event.data.endDate = ContentEvent.event.data.startDate; + ContentEvent.event.data.endTime = moment(ContentEvent.event.data.startTime).add('10', 'minute'); + } + balanceDateTime(); if (event.isAllDay) { // Check if start date of the event is not less than repeat event starts on date if (event.repeat && event.repeat.isRepeating && event.repeat.startDate) diff --git a/test/control/content/content.event.controller.spec.js b/test/control/content/content.event.controller.spec.js index 037fc5e..5b322c4 100644 --- a/test/control/content/content.event.controller.spec.js +++ b/test/control/content/content.event.controller.spec.js @@ -185,7 +185,7 @@ describe('Unit : Event Manual Plugin content.event.controller.js', function () { }; ContentEvent.setEndDay(); $rootScope.$apply(); - expect(ContentEvent.event.data.endDate).toEqual('Sun Oct 16 2016 00:00:00 GMT+0530 (IST)'); + expect(ContentEvent.event.data.endDate).toEqual(1476556800000); }); it('it should pass if ContentEvent.editLink', function () {