Created
May 24, 2012 17:32
-
-
Save TastyToast/2782958 to your computer and use it in GitHub Desktop.
Formatting the date for page manager sweeps
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
<div id="start-date"> | |
{{ my_sweeps.start_date }} | |
</div> | |
<script src="https://s3.amazonaws.com/wildfireapp/assets/momentjs/moment.min.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
(function($) { | |
$(document).ready(function() { | |
function formatDate(date) { | |
formattedDate = date.text(); | |
var d = moment(formattedDate, "YYYY-MM-DDTHH:mm:ss"); | |
$(date).html( d.format("dddd, MMMM Do YYYY, h:mm:ss a")); | |
}; | |
formatDate($('#start-date'));// here we pass in our element we would like to replace only works for ID's | |
//if it's a class.... | |
$('.entry-date').each(function() { | |
formatDate($(this)); | |
}); | |
}); | |
})(jQuery); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment