Created
April 16, 2010 20:49
-
-
Save cjolly/368952 to your computer and use it in GitHub Desktop.
jQuery hack for 12 hour datetime selects in rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertDateTimeSelectTo12Hour() { | |
var translate = {"00":"Midnight","01":"1am","02":"2am","03":"3am","04":"4am","05":"5am","06":"6am","07":"7am","08":"8am","09":"9am","10":"10am","11":"11am","12":"Noon","13":"1pm","14":"2pm","15":"3pm","16":"4pm","17":"5pm","18":"6pm","19":"7pm","20":"8pm","21":"9pm","22":"10pm","23":"11pm"}; | |
$("select[name$='(4i)]'] option").each(function() { | |
$(this).text(translate[$(this).text()]); | |
}); | |
} |
It's parsing that in octal so 08 and 09 are not valid octal.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
weird parseInt() behavior: