Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: [1]   Go Down
Print
Author Topic: List view broke on DEC 1  (Read 490 times)
0 Members and 1 Guest are viewing this topic.
Alvy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: December 05, 2003, 01:45:00 AM »

I have my list view to display all event starting with the next month.. and that was working until dec 1.
here is the date string I had
code:
<%
$startTime = Time::Local::timegm(0, 0, 0, 1, $MONTH, $YEAR-1900);
$endTime = Time::Local::timegm(0, 0, 0, 1, $MONTH, $YEAR-1899) ;
&getEvents( {'start'=>$startTime, 'end'=>$endTime});
%>

I tried many variations of -/+ 1 and using an if $MONTH > 11 ( i even tried if $MONTH > 12) ...
the only way I could keep the list view from errors is to use this code

code:

<%
$startTime = Time::Local::timegm(0, 0, 0, 1, $MONTH-1, $YEAR-1900);
$endTime = Time::Local::timegm(0, 0, 0, 1, $MONTH-1, $YEAR-1899) ;
&getEvents( {'start'=>$startTime, 'end'=>$endTime});
%>

But that display includes this month and I only want from NEXT month on.

any help??
thanks

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: December 05, 2003, 01:13:00 PM »

** $YEAR-1900 **

Well since $YEAR-1900 will equate to this year, it is unlikely to retrieve events from next year using it. You'll likely have to do something about what year you're specifying to retrieve events from.

You'll also likely have to do something different with the $MONTH variable as I do not believe you can just add 1 to December to get January.

Dan O.


[This message has been edited by DanO (edited December 05, 2003).]

Logged
Alvy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #2 on: December 05, 2003, 09:27:00 PM »

I got a temp fix for it... but not sure why it works??

code:
$startTime = Time::Local::timegm(0, 0, 0, 1, $MONTH-12, $YEAR-1899);
$endTime = Time::Local::timegm(0, 0, 0, 1, $MONTH-1, $YEAR-1899) ;
&getEvents( {'start'=>$startTime, 'end'=>$endTime});


What does the string 0,0,0,1, do?
Why does $MONTH give me next month?
Why does is it -12, should it not be -11 since the months are 0-11?


------------------


[This message has been edited by Alvy (edited December 05, 2003).]

[This message has been edited by Alvy (edited December 05, 2003).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #3 on: December 05, 2003, 09:57:00 PM »

** What does the string 0,0,0,1, do?  **

That's not a string but 4 separate values being passed to the Time::Local::timegm function (along with the rest). I believe they represent 0 seconds, 0 minutes, 0 hours, 1st day of the month.

** Why does $MONTH give me next month? **

From the documentation under "Defined Variables":

$MONTH - The month number of the currently displayed date.

** Why does is it -12, should it not be -11 since the months are 0-11? **

You'd have to look at the way the Time::Local::timegm function uses the values you're passing it. I really don't know.

Dan O.

------------------

Logged
Alvy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #4 on: December 05, 2003, 09:57:00 PM »

I just realized I will have to change it back in JAN... that shouldn't be the way it should work right?/
code:

<%$startTime = Time::Local::timegm(0, 0, 0, 1, $MONTH, $YEAR-1900);
$endTime = Time::Local::timegm(0, 0, 0, 1, $MONTH, $YEAR-1899) ;
if $MONTH > 12{$startTime = Time::Local::timegm(0, 0, 0, 1, $MONTH-12, $YEAR-1899);
$endTime = Time::Local::timegm(0, 0, 0, 1, $MONTH-1, $YEAR-1899) ;}
&getEvents( {'start'=>$startTime, 'end'=>$endTime});%>

Or something like that to account for the 12th month?

I know I prolly have some errors in that...

------------------

Logged
Alvy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #5 on: December 05, 2003, 10:04:00 PM »

 
quote:

** Why does $MONTH give me next month? **

From the documentation under "Defined Variables":

$MONTH - The month number of the currently displayed date.



I think it may be that $MONTH represents the number of the month as shown in a date... 1-12, and we are passing it to the time function which should only understand months as 0-11. so in the first string, it is $MONTH is passing this month which is really one month+1.
Does that make sense?

------------------

[This message has been edited by Alvy (edited December 05, 2003).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #6 on: December 06, 2003, 01:07:00 PM »

** if $MONTH > 12 **

JFYI $MONTH will never be greater than 12. It would need to be 13 to satisfy that if clause and as is, would never execute.

** I think it may be that $MONTH represents the number of the month as shown in a date... 1-12 **

I believe so.

Dan O.

------------------

Logged
Pages: [1]   Go Up
Print
Jump to: