Display month & last sunday of month. Help with my code
Here's what I have so far. I'm getting closer. I can write the date of last sunday of the month but I can't seem to get the current month to display properly.
Example: for this month I want the code to display January 27 but I'm getting December 27. 27 IS the correct date because 27 is the last Sunday in this month but (obviously) I need it to display January because Januuary IS the current month.
If anyone can help me get that sorted I'd appreciate it.
var d = new Date();
var monthNames = [ "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" ];
d.setMonth( d.getMonth() + 0 );
lastsunday = d.getDate() - (d.getDay() + 3);