localendar Forums Homepage

Print at Sep 2, 2025, 9:40:46 AM View all posts in this thread on one page
Posted by TravisTigerBand at May 25, 2008, 1:13:38 AM
One week look ahead... how do I do that on the W1 Style
Hi,
This is a newbie JavaScript Question.
I'm using the list format W1.
Is there a easy way to do a one week look ahead from the current week?
I want to see NEXT week's events.
I'm hoping someone has already written something.
Thanks
-BB-

Posted by jamiecd77 at May 26, 2008, 3:50:41 AM
Re: One week look ahead... how do I do that on the W1 Style
I think we can handle that....

try adding the start date criteria to your link/code.

for example

http://www.localendar.com/public/travistigerband?style=W1&start_date=6/1/2008

When using the W1 style, the start date tells your calendar what week to display, The above example will actually start on the second, If you change the date to 6/3/2008, it will still start on the second.

hope that helps,

Jamie
----------------------------------------
Peer-Support Specialist

Posted by TravisTigerBand at May 27, 2008, 1:05:09 PM
Re: One week look ahead... how do I do that on the W1 Style
Hello again.

Thanks Jamie.

Using the date in the string I understand.

However, I want to dynamically change the date in the JS String to be 7 days from now.

Example:
If today were 6/1/2008, I want to present for 6/8/2008
If today were 6/8/2008, I want to present for 6/15/2008

Like the way the month forward button works but for a 1 week increment.

I've looked into the set.date method, but I don't know how to push and/or pull the new date into the W1 string.

crying

Thanks
-BB-

Posted by jamiecd77 at May 28, 2008, 5:38:58 PM
Re: One week look ahead... how do I do that on the W1 Style
Alack, I think you are going to have to code that yourself...There is no method that I know of in Localendar to call "next week" from the initial published calendar.

Of course, the arrows on the top and bottom automatically go to next week, but I think the publishjump routine the arrows use is a lookup table...

Marc, ideas?
----------------------------------------
Peer-Support Specialist

Posted by TravisTigerBand at May 29, 2008, 9:16:01 AM
Re: One week look ahead... how do I do that on the W1 Style
I found something...
I can build the string, but how do I get the scr to accept it?

<html>
<body>

<script type="text/javascript">

var today = new Date();

today.setDate(today.getDate()+7)

var theMonth = today.getMonth()+1;
var theDay = today.getDate();
var theYear = today.getYear();
var thestring ="http://www.localendar.com/public/travistigerband?include=Y&style=W1&start_date="+(theMonth + "/" + theDay + "/" + theYear);



document.write (thestring);


</script>

<SCRIPT language="Javascript" src= thestring > </SCRIPT>

</body>
</html>

Posted by support at May 30, 2008, 12:08:08 AM
Re: One week look ahead... how do I do that on the W1 Style
How's about something like this?

<html>
<body>

<script type="text/javascript">
var today = new Date();

today.setDate(today.getDate()+7)

var theMonth = today.getMonth()+1;
var theDay = today.getDate();
var theYear = today.getYear();
var thestring =
"http://www.localendar.com/public/travistigerband?include=Y&style=W1&start_date="+(theMonth + "/" + theDay + "/" + theYear);

function staticLoadScript(url)
{
document.write('<script src="', url, '" type="text/javascript"><\/script>');
}

staticLoadScript(thestring);

</script>

</body>
</html>

----------------------------------------
Marc Higgins
Support Associate, localendar.com
Follow us on Twitter! http://www.twitter.com/localendar_news

Posted by TravisTigerBand at May 30, 2008, 7:48:40 AM
Re: One week look ahead... how do I do that on the W1 Style
Sweet!
Thank you! biggrin


Posted by TravisTigerBand at May 30, 2008, 11:56:59 PM
Re: One week look ahead... how do I do that on the W1 Style
One issue appeared in Firefox and Safari... The string HAS to be MM/DD/YY.

Cheap and dirty fix... (Ugly!)

if (theMonth < 10)
{
theMonth = "0"+ theMonth.toString()
}


if (theDay < 10)
{
theDay = "0"+ theDay.toString()
}


theYear = theYear - 2000

if (theYear < 10)
{
theYear = "0"+ theYear.toString()
}


Got a better way?

-BB-


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