Skip to content

Instantly share code, notes, and snippets.

@dandiebolt
Created July 24, 2015 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dandiebolt/bfe0d2c0be0cbfe1ae1f to your computer and use it in GitHub Desktop.
Save dandiebolt/bfe0d2c0be0cbfe1ae1f to your computer and use it in GitHub Desktop.
(function(){
var querystring=document.location.search;
if(/a=er/i.test(querystring) || /nwr/i.test(querystring)) {
$("#_fid_7").on("blur", function() {
var oldValue = this.value;
var newValue = oldValue
.replace(/(\d{2})(\d{2})/g, function($0, $1, $2) {
var hours = parseInt($1, 10);
var minutes = parseInt($2, 10);
if (hours < 12) {
return hours + ":" + ("0" + minutes).substr(-2) + " AM";
} else {
return (hours-12) + ":" + ("0" + minutes).substr(-2) + " PM";
}
});
$(this).val(newValue);
});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment