Skip to content

Instantly share code, notes, and snippets.

@maxxcrawford
Last active December 17, 2015 16:09
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 maxxcrawford/5636909 to your computer and use it in GitHub Desktop.
Save maxxcrawford/5636909 to your computer and use it in GitHub Desktop.
Show/Hide Date Expiration
var dateExpire = function(){
var today = new Date(); //Get Raw Current Date
var dd = today.getDate(); // Formate Date
var mm = today.getMonth()+1; // Format Month
var yyyy = today.getFullYear();
if(dd<10){dd='0'+dd} if(mm<10){mm='0'+mm} today = mm+'/'+dd+'/'+yyyy; // Assemble mm/dd/yy date
$('.boo').each(function(){
if ($(this).attr('data-expire') < today){
$(this).hide();
} else {
// Date shows by default $(this).show();
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment