Last active
May 11, 2016 16:05
-
-
Save TechFounder/0e1e7c03635ee9d53a794c4e42666f62 to your computer and use it in GitHub Desktop.
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