EOM or two days from now

by greatCar

JavaScript

function dateToEom ()
{

var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };

var today = new Date();

//return today;
var eom = new Date(today.getFullYear(), today.getMonth()+1, 0);
//alert (eom);
var lastDay = eom.getDate();
var todaysDay = today.getDate();

var eomOrTwo =  (lastDay - todaysDay) >=2 ? eom: new Date(today.getFullYear(), today.getMonth() +2, 2);

return eomOrTwo.toLocaleDateString("en-US",options)



}
alert (dateToEom());
return;

var today = new Date();
//alert (today);
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };

alert( dateToEom().toLocaleDateString("en-US",options) );


//var dd = new Date();

//alert("g");