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;
var datenow = [year, month, day].join('-');
var time = [hours, minutes, "00"].join(':');
var currentDate = datenow + ' ' + time;
- var ndate = new Date(datenow);
+ // Using datenow in the constructor here converts to local time. If not
+ // running on GMT (or east) then comparison to toDateString below fails.
+ // Also use month-1 because...javascript.
+ var ndate = new Date(year, month-1, day, 0, 0, 0);
model.the_date = currentDate;
$rootScope.$digest();