Bugfix: sometimes the string returned from getTimeStringFromDate() is invalid (ie. the string doesn’t match a value in the <select>) causing the <select> not to be set which in turn causes $(<select>).val().trim() to fail as val() returns null.