if (hour == 12 && pm[meridian]);
else if (hour == 12) hour = '00';
else if (pm[meridian]) hour = parseInt(hour) + 12;

OR

if (pm[meridian] && hour != 12) parseInt(hour) + 12;
else if (hour == 12 && pm[meridian] == 'undefined') hour = '00';