localendar Forums Homepage


Print at Nov 7, 2025, 12:26:57 PM

Posted by support at Jan 13, 2013, 5:30:23 PM
Re: Show next month
We do dynamic month substitution in the title:
http://www.localendar.com/docs/display/lc/Dynamic+replacement+of+month+name+or+number

However, if I understand you correctly, you want links that automatically go to the current month, next month, etc.

The easy part is: The calendar always defaults to the current month. So
http://www.localendar.com/public/n1lykme will always be "this month"

I think you can get what you want using our "start_date" parameter(http://www.localendar.com/docs/display/lc/Your+Calendar%27s+URL+and+Parameters), a little JavaScript and Date arithmetic. Hopefully this is close enough to get you started:

<a href='http://www.localendar.com/public/n1lykme'>This Month</a><br/>
<script>
function getNextCalendarMonth(in_date)
{
if (in_date.getMonth() == 11) {
var out_date = new Date(in_date.getFullYear() + 1, 0, 1);
} else {
var out_date= new Date(in_date.getFullYear(), in_date.getMonth() + 1, 1);
}
return out_date;
}
function formatDate(in_date)
{
var out_string = "";
out_string = (in_date.getMonth()+1)+"/"+in_date.getDate()+"/"+in_date.getFullYear();
return out_string;
}

var mplus1=getNextCalendarMonth(new Date());
var mplus2=getNextCalendarMonth(mplus1);
var mplus3=getNextCalendarMonth(mplus2);
var mplus4=getNextCalendarMonth(mplus3);
document.write("<a href='http://www.localendar.com/public/n1lykme?start_date="+formatDate(mplus1)+"'>This Month+1</a><br/>");
document.write("<a href='http://www.localendar.com/public/n1lykme?start_date="+formatDate(mplus2)+"'>This Month+2</a><br/>");
document.write("<a href='http://www.localendar.com/public/n1lykme?start_date="+formatDate(mplus3)+"'>This Month+3</a><br/>");
document.write("<a href='http://www.localendar.com/public/n1lykme?start_date="+formatDate(mplus4)+"'>This Month+4</a><br/>");
</script>


whoa.. too much free time today wink
----------------------------------------
Marc Higgins
Support Associate, localendar.com
Follow us on Twitter! http://www.twitter.com/localendar_news

Help! | Cobranding | Legal | Privacy Policy | About localendar.com | Contact Us