Created
July 24, 2015 00:54
-
-
Save dandiebolt/bfe0d2c0be0cbfe1ae1f to your computer and use it in GitHub Desktop.
This file contains 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(){ | |
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