Skip to content

Instantly share code, notes, and snippets.

@victorzen
Last active August 14, 2017 02:21
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 victorzen/caa959f6a4aa1595beaf67dfd35d750a to your computer and use it in GitHub Desktop.
Save victorzen/caa959f6a4aa1595beaf67dfd35d750a to your computer and use it in GitHub Desktop.
Trigger a convertable between two given dates
<script>
  
    //Add your Convertable code. Don't forget to add \ before the closing > as in the exmple below.
    var convStr = '<script src="//a0a1179f80df414f91512d8919c3e847.js.ubembed.com" async></script\>';	
  
    //Add the start and end dates using the format mm/dd/yyyy. 
    var startDate = '05/05/2017';
    var endDate = '05/09/2017';
  
    /*DON'T CHANGE ANYTHING BELOW THIS LINE!*/
    var curr_date = getDate(); 
    if (curr_date >= startDate && curr_date <= endDate) {
    	$("body").prepend(convStr); 
    }
    function getDate() {
    	var d = new Date();
    	var day = d.getDate();
	var month = d.getMonth()+1;
        var output = ('0'+month).slice(-2)+'/'+('0'+ day).slice(-2)+'/'+d.getFullYear();
    	return output;
    }
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment