After switching to 24-hour format for my strings, I'm confused as to why the times are not comparing correctly. What am I doing incorrectly?
function convertToTwentyFourHourTime(amPmString) {
var d = new Date("1/1/2013 " + amPmString);
return d.getHours() + ':' + d.getMinutes();
}
var inputStartTime = "6:00 AM";
var inputEndTime = "10:00 PM";
var startTime = convertToTwentyFourHourTime(inputStartTime);
var endTime = convertToTwentyFourHourTime(inputEndTime);
if(startTime < endTime){
alert("It's working!");
}