Scott Baldridge
asked on
Help with varible assignment
Hello, with my code below I keep getting an error:
Uncaught Error: Syntax error, unrecognized expression: 8/23/2016 01:00:00
on this line when I try to populate: frdi
if (frdiD != ''){
frdi = $(this.concatenateDateTime (frdiD, frdiT));
}
I'm learning javascript and don't understand what this error means. What am I doing wrong?
Uncaught Error: Syntax error, unrecognized expression: 8/23/2016 01:00:00
on this line when I try to populate: frdi
if (frdiD != ''){
frdi = $(this.concatenateDateTime
}
I'm learning javascript and don't understand what this error means. What am I doing wrong?
validateDates: function () {
$('.firstSecondValMsg').html('');
$('.secondClientValMsg').html('');
var frdiD = $("#FirstReviewDeadlineInterim").val();
var frdiT = $("#FirstReviewDeadlineInterimTime").val();
var frdi = '';
if (frdiD != ''){
frdi = $(this.concatenateDateTime(frdiD, frdiT));
}
var srdiD = $("#SecondReviewDeadlineInterim").val();
var srdiT = $("#SecondReviewDeadlineInterimTime").val();
var srdi = '';
if (srdiD != '') {
srdi = $(this.concatenateDateTime(srdiD, srdiT));
}
var cdiD = $("#ClientDeadlineInterim").val();
var cdiT = $("#ClientDeadlineInterimTime").val();
var cdi = '';
if (cdiD != '') {
cdi = $(this.concatenateDateTime(cdiD, cdiT));
}
if ($(this.compareTime(frdi, srdi)) && srdi != '') {
$('.firstSecondValMsg').html("First Review Deadline is greater than Second Review Deadline.").css({ 'color': 'red', 'font-weight': 'bold' });
}
if ($(this.compareTime(srdi, cdi)) && cdi != '') {
$('.secondClientValMsg').html("Second Review Deadline is greater than Client Deadline.").css({ 'color': 'red', 'font-weight': 'bold' });
}
},
compareTime: function (time1, time2) {
return new Date(time1) > new Date(time2);
},
concatenateDateTime: function (date, time) {
if(date != ''){
var datetime = new Date(Date.parse(date + ' ' + time));
var month = datetime.getMonth() + 1;
var day = datetime.getDate();
var year = datetime.getFullYear();
var hour = datetime.getHours();
if (hour < 10)
hour = "0" + hour;
var min = datetime.getMinutes();
if (min < 10)
min = "0" + min;
var sec = datetime.getSeconds();
if (sec < 10)
sec = "0" + sec;
var dateTimeString = month + '/' + day + '/' + year + ' ' + hour + ':' + min + ':' + sec;
return dateTimeString;
}
},
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER