SquareSpace javascript to remove day from date format
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
// you may need to first load jquery | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.js'></script> | |
$(document).ready(function () { | |
$('time span').remove(); | |
}); | |
// or if that doesn't work try this.... | |
var monthNames = [ "January", "February", "March", "April", "May", "June", | |
"July", "August", "September", "October", "November", "December" ]; | |
$(document).ready(function () { | |
$("time").each( function () { | |
var fullDate = new Date($( this ).text()); | |
$( this ).text(monthNames[fullDate.getMonth()] + " " + fullDate.getFullYear()); | |
}); | |
}); | |
// this doesn't really work | |
$(document).ready(function () { | |
$("time").each( function () { | |
var parts = $( this ).text().split(" "); | |
parts.splice(1, 1); | |
$( this ).text(parts.join(" ")); | |
}); | |
}); | |
// nor this | |
$(document).ready(function () { | |
setTimeout(function(){ | |
$("time").each( function (index) { | |
var parts = $( this ).text().split(" "); | |
parts.splice(1, 1); | |
$( this ).text(parts.join(" ")); | |
}); | |
}, 1000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment