Created
December 11, 2019 16:47
-
-
Save neodigm/83509f6b1e250c8dd916530d9101f95a to your computer and use it in GitHub Desktop.
Order by date logic - eComm
This file contains hidden or 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
"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