phstc/jquery-dateFormat — Issue #16: "h" format throws exception causing blank date during conversion
Author: gwilson2151
Created: 2011-10-21 04:57:47+00:00
State: open

If you use "h" formatting on an hour > 12 the value is actually an integer and throws an exception if you try to substr it. This results in no result at all.

case "h":
if (format.charAt(i + 1) == "h") {
break;
}
/* time.hour is "00" as string == is used instead of === */
var hour = (time.hour == 0 ? 12 : time.hour < 13 ? time.hour : time.hour - 12);
if (__typeof hour == 'string' &&__ hour < 10) {
hour = hour.substr(1, 1);
}
retValue += hour;
pattern = "";
break;