Skip to content

Instantly share code, notes, and snippets.

@neodigm
Created December 11, 2019 16:47
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 neodigm/83509f6b1e250c8dd916530d9101f95a to your computer and use it in GitHub Desktop.
Save neodigm/83509f6b1e250c8dd916530d9101f95a to your computer and use it in GitHub Desktop.
Order by date logic - eComm
"use strict";
var oOrderBy = function(){
var eLink = document.querySelector("[data-reveal-id='#exp_info_modal']");
return {
init: function( _t ){
if( eLink ){
var eP = document.createElement( "span" );
var nDays = 2;
if( ( _t.getHours() >= 12 ) ) nDays++;
eP.style.display = "block";
eP.style.color = "#888";
eP.style.fontSize = "11px";
eP.innerHTML= "Order by 1pm today and get it by Dec " + ( _t.getDate() + nDays ) + "th.";
eLink.parentNode.insertBefore( eP, eLink.nextSibling);
}
}
};
}();
oOrderBy.init( new Date() );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment