Easy PHP Calendar - We really take care of your dates!


Go Back   Easy PHP Calendar > General Discussion > General Support

General Support Questions about using the Easy PHP Calendar. (Not installation or customizations)

Closed Thread
 
Thread Tools Search this Thread Display Modes

Old 06-25-2003, 10:21 PM   #1
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

I have a weird problem.... I have two hosts... One production, and one dev... I use the same config on both, yet on my dev the highlighted days are all one day late..... I don't understand what's going on..

Here's what's happening..

Production

Dev

The production server is running Apache on a Linux platform, and the dev server is running IIS6 on Win2003.

Help me please!!!!!
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 06-25-2003, 11:05 PM   #2
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,878
Default

I've taken a look at both of your sites and I'm not sure what could be causing this. With over 30,000 downloads, I've never heard of this problem before. :blink:

Has the source code been modified at all?

The strange part is that it is marking today's date correctly so the first place I would look would be the source code and see if it was changed somehow.
__________________
-- Brian

Questions?

Instructions: Version 6 - Version 7 | FAQ | Errors FAQ | Paths FAQ | Forums | Support
| Web Site Hosting
 

Old 06-25-2003, 11:19 PM   #3
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

The only sections where the source code was modified is the sections defining the colors and the default values for the variables..... other than that nothing has been modified...

AND! both the scripts are exact copies..... in fact just before I posted this I re-downloaded the script from my production to my dev server..... and it's still the same...

:huh: me no comprendo...... :P

How can the values be changed..... and all consistently.... I could understand if it was only 1 day... but all of em... You can also check the current month and you'll see the same thing....

This makes absolutely no sense at all..... I'm going :wacko:
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 06-26-2003, 11:58 AM   #4
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,878
Default

Can you PM me a complete copy of the file from the server that's showing the incorrect days being marked?
__________________
-- Brian

Questions?

Instructions: Version 6 - Version 7 | FAQ | Errors FAQ | Paths FAQ | Forums | Support
| Web Site Hosting
 

Old 06-26-2003, 12:00 PM   #5
ricur
Calendar User
 
ricur is offline
Join Date: Jun 2003
Posts: 11
Default

I also have this problem.
Basically, I copied the whole escalendar.php script into another file, and at the top of the page, hardcoded $es = "2004-11-01";
$ee = "2004-12-01";
$mn = 11;
$yr = 2004.

For some reason, Mon 1st Nov is not coloured, but if I go to $mn = 12, and look, the 2nd of dec is coloured in for some strange reason.

If I try this on your website version (ie, using the configuration tool), it works fine.
I am running apache2, php 4.2.2.
I am quite desperate to sort this - can you help ?
Richard
 

Old 06-26-2003, 12:19 PM   #6
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

Ricur, are you sure that your highlights are the right colors... because your event is set to be from Nov 1 to Dec 1..... so if you inverted your highlight color with the normal color, you'd get normal colors for the event, and then highlights for outside of the event... which falls on Dec 2...

I hope I'm making sense to you...


Papa, I just PMed you the whole file.. and both servers are using the exact same file. Downloaded from one, uploaded on the other...
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 06-26-2003, 12:22 PM   #7
ricur
Calendar User
 
ricur is offline
Join Date: Jun 2003
Posts: 11
Default

My highlights are the default colours.
I have just done some playing round, and I can fix it by changing the code slightly - I havent tested it thoroughly tho - I only tested it on my specific date range of 2004-11-01 -> 2004-12-01.

I changed the following:
while ($i < $smc) {
$es[$i] = ereg_replace('-','/', $es[$i]);
$ee[$i] = ereg_replace('-','/', $ee[$i]);
$start = intval(strtotime ($es[$i])/86400)+1;
$end = intval(strtotime ($ee[$i])/86400)+1;

to read:
while ($i < $smc) {
$es[$i] = ereg_replace('-','/', $es[$i]);
$ee[$i] = ereg_replace('-','/', $ee[$i]);
$start = intval(strtotime ($es[$i])/86400);
$end = intval(strtotime ($ee[$i])/86400);
 

Old 06-26-2003, 01:20 PM   #8
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

do you have a link to your calendar?
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 06-26-2003, 02:31 PM   #9
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

Hey Ricur... when I did what you did on mine.. (removed the +1 for $start and $end).. it fixed it!

I don't quite understand why that 1 second makes the difference but hey... whatever works...
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 06-26-2003, 03:39 PM   #10
ricur
Calendar User
 
ricur is offline
Join Date: Jun 2003
Posts: 11
Default

Sorry - I dont have an external link that I can provide due to company confidentiality etc etc.
I *THINK* the error is due to leap years or daylight saving changes etc.
Anyway, glad it helped

Hopefully it will work for me (following further testing of course).

Any thoughts from the developers ????

Rich
 

Old 06-26-2003, 07:39 PM   #11
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

Hi Ricur and Papa,

I have figured out my "problem"..... Ricur's problem pointed me in the right direction.

What's happening is that my production server is set in some timezone that I'm not too sure about... but it doesn't use DST at all..... Where as my dev server is currently in the Atlantic Time Zone with Daylight Savings enabled... As soon as I turned it off, dates were fine...

Kinda weird if you ask me... I thought it'd take the clock settings, but seeing as how the clock is not actually changed when you enable DST, I guess that it messes things up... I guess DST shouldn't be turned on anyways on a server... anywho... if anyone else has that problem... well, there's your fix

Thanks again for a great product Papa!!
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 06-26-2003, 09:40 PM   #12
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,878
Default

Wow!

Great work. I'll add that as an option that can be set by the user in the next version of the script.
__________________
-- Brian

Questions?

Instructions: Version 6 - Version 7 | FAQ | Errors FAQ | Paths FAQ | Forums | Support
| Web Site Hosting
 

Old 06-27-2003, 12:59 AM   #13
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

This has to be a platform issue with PHP and Win2K3 I'm guessing.... because it displays right on my Linux server, it's also ok on my WinXP (installed it just for the purpose of testing this)..... it's only my 2003 Server that causes problems... anyways, I changed the code somewhat to make it work on my dev server.....

I'm pasting here the same code snipit that Ricur had posted before... and commented out the original lines and followed them with the edited ones...

Code:
while ($i < $smc) {

$es[$i] = ereg_replace('-','/', $es[$i]);
$ee[$i] = ereg_replace('-','/', $ee[$i]);
//$start = intval(strtotime ($es[$i])/86400)+1;
//$end = intval(strtotime ($ee[$i])/86400)+1;
$start = intval(strtotime ($es[$i])/86400)+!date("I", strtotime ($es[$i]));
$end = intval(strtotime ($ee[$i])/86400)+!date("I", strtotime ($ee[$i]));
So what it does now is a check to see if the date for the start and end are affected by DST (which is what date("I") returns.

Anyways.... it's now working on my server, but I'm not sure this will help anyone else out there as it seems I'm the only one affected.....

I'd like to be able to confirm that it's due to the platform..... but this seems the most likely cause of the problem.

Papa: feedback on this?
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 06-27-2003, 04:21 AM   #14
ricur
Calendar User
 
ricur is offline
Join Date: Jun 2003
Posts: 11
Default

I still have the problem even after both ve9gra and my own fix attempts.
I dont know why, but by removing the "!" from ve9gra's fix, it seems to work correctly.:
$start = intval(strtotime ($es[$i])/86400)+date("I", strtotime ($es[$i]));
$end = intval(strtotime ($ee[$i])/86400)+date("I", strtotime ($ee[$i]));

I am in UK (so we are in BST at the moment, or GMT the rest of the time).
BTW, I am on Linux so it cant be a Win2k3 issue.
 

Old 06-27-2003, 12:15 PM   #15
ricur
Calendar User
 
ricur is offline
Join Date: Jun 2003
Posts: 11
Default

OK I have sorted the problem.
The fix by ve9gra seems to work fine - the reason I still had the problems was due to another (almost identical coincidentally) bug in my own code which was used to decided which squares to colour.

Anyway, all is sorted now.

Thanks all
 

Old 06-28-2003, 01:16 AM   #16
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

Ricur: Don't use my previous "fix"!!!! I found a bug in it... Here's the explanation.

The original code will affect either from May-Oct or from Nov-Apr (as far as I can tell)... If you have DST enabled.

I modified the calender display to be able to figure out how the marking was taking place. I changed it so that you see it in this format... <day of month>-<day number since Jan 1, 1970>... Use the different styles as guidelines to follow...

=======
Style 1 - Original calendar code
http://ve9gra.gotdns.org/reuse/calendar/year1.html

Highlighted in red, you can see that there's days overlapping (April-May) and days missing (Oct-Nov)...

So if I mark any days in the May-Oct period, you can see that it marks it one day late. Here I'm marking June 1, 2003 and it's highlighting June 2.

Onto my first fix...

========
Style 2 - Modification of the highlight function
http://ve9gra.gotdns.org/reuse/calendar/year2.html

Here's the code that was changed.....
Code:
//$start = intval(strtotime ($es[$i])/86400)+1;
//$end = intval(strtotime ($ee[$i])/86400)+1;
$start = intval(strtotime ($es[$i])/86400)+!date("I", strtotime ($es[$i]));
$end = intval(strtotime ($ee[$i])/86400)+!date("I", strtotime ($ee[$i]));
In this one you see that where the days mess up are actually the days where the time changes from Standard Time to Daylight Savings Time.... You see in green that the past problem is fixed, and in red, where the problem is now.

The problem with this fix is that it only addresses the highlighting.. When the calendar is being built, it still uses the same day numbers as in style 1... but it highlights them using style 2... So for 2003, anything highlighted between April 6 to 30, and October 26 to 31 would be messed up.

Here I'm highlighting April 7 and April 6 is highlited.

Same for October 27...

So..... I tried to fix that too...

========
Style 3 - Modification of the day numbering function
http://ve9gra.gotdns.org/reuse/calendar/year3.html

Here I undid what I did in Style 2
Code:
$start = intval(strtotime ($es[$i])/86400)+1;
$end = intval(strtotime ($ee[$i])/86400)+1;
//$start = intval(strtotime ($es[$i])/86400)+!date("I", strtotime ($es[$i]));
//$end = intval(strtotime ($ee[$i])/86400)+!date("I", strtotime ($ee[$i]));
But I changed a different section
Code:
//$tnum = (intval((date ("U", mktime(20,0,0,$tmo,$tda,$tyr))/86400))); // TODAY'S DAY NUMBER
$tnum = (intval((date ("U", mktime(21,0,0,$tmo,$tda,$tyr))/86400))); // TODAY'S DAY NUMBER
...
//$daycount = (intval((date ("U", mktime(20,0,0,$mo,1,$yr))/86400)))-$ds; // FIRST OF MONTH DAY NUMBER
$daycount = (intval((date ("U", mktime(21,0,0,$mo,1,$yr))/86400)))-$ds; // FIRST OF MONTH DAY NUMBER
Changed from mktime(20 to mktime(21

By changing this I was avoiding the 1 hour change when I'd enter or leave the DST, forcing to have a 1am timestamp instead of midnight... You can see that all the previous affected regions are now in green... All was working A-OK using this version, but then I started to think about the other timezones... if it would affect them or not. Then, this is when I found another bug by fluke...

If you look at Jan 1, the day number is 12054 and if you times that by 24*60*60 (number of seconds in 1 day), you get 1041465600 which should be the number of seconds since EPOC (Jan 1, 1970 GMT). BUT!! when I checked that number using echo date("D M j G:i:s T Y",12054*24*60*60), I actually got Wed Jan 1 20:00:00 Atlantic Standard Time 2003 which meant Jan 2, 2003 0:00 GMT...

so... last fix...

========
Style 4 - Modification of day numbering AND day highlighting functions
http://ve9gra.gotdns.org/reuse/calendar/year4.html

You can see here that Jan 1 is now 12053... what it should be...

Here's what has to be modified
Code:
//$tnum = (intval((date ("U", mktime(20,0,0,$tmo,$tda,$tyr))/86400))); // TODAY'S DAY NUMBER
$tnum = (intval((date ("U", mktime(0,0,0,$tmo,$tda,$tyr)-(intval(date("O", mktime(0,0,0,$tmo,$tda,$tyr)))*36))/86400))); // TODAY'S DAY NUMBER
...
//$daycount = (intval((date ("U", mktime(20,0,0,$mo,1,$yr))/86400)))-$ds; // FIRST OF MONTH DAY NUMBER
$daycount = (intval((date ("U", mktime(0,0,0,$mo,1,$yr)-(intval(date("O", mktime(0,0,0,$mo,1,$yr)))*36))/86400)))-$ds; // FIRST OF MONTH DAY NUMBER
And
Code:
//$start = intval(strtotime ($es[$i])/86400)+1;
//$end = intval(strtotime ($ee[$i])/86400)+1;
$start = intval(strtotime ($es[$i])/86400);
$end = intval(strtotime ($ee[$i])/86400);
What this does is reset the day number to actually follow GMT and readjust the time using the timezone of the server (date("O") returns the difference from GMT). For the second part, since now mktime() actually matches the result of strtotime(), there's no need to have the +1 there.....

Well..... there you have it guys... That's as far as I can think..... tested on both my servers with good results even if they're in different timezones..

I'd like it if more ppl could try it out and see if it actually fixes anything.. Especially from different time zones.

And Ricur, I'd like if you could try it and see if it works well on your server too...
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 06-28-2003, 04:34 AM   #17
ricur
Calendar User
 
ricur is offline
Join Date: Jun 2003
Posts: 11
Default

Wow. You have been busy.
I will take a good look at your fix on Monday when I get back to work - I dont have access to the servers from home
Anyway, thanks a lot and I will get back to you.

Richard
 

Old 06-28-2003, 09:54 AM   #18
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,878
Default

ve9gra, are you a technical writer? That was a great explanation.

I'll test this out on my server and see what happens. If anyone else wants to try this, please post your results in this thread.
__________________
-- Brian

Questions?

Instructions: Version 6 - Version 7 | FAQ | Errors FAQ | Paths FAQ | Forums | Support
| Web Site Hosting
 

Old 06-28-2003, 11:37 AM   #19
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

Technical writer.. :lol: I wish!! I was getting tired and was just rambling on...

Thanks for the compliment though

Hope this will work for everybody.
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 06-29-2003, 09:12 PM   #20
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

WHOO HOO

My code made it to an official release :lol:

That made my day!!! B)
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 06-30-2003, 04:24 AM   #21
ricur
Calendar User
 
ricur is offline
Join Date: Jun 2003
Posts: 11
Default

Hi again.
I have just tried your patches, and unfortunately, it completely broke my version

The only changes I made were :

Code:
//$tnum = (intval((date ("U", mktime(20,0,0,$tmo,$tda,$tyr))/86400))); // TODAY'S DAY NUMBER
$tnum = (intval((date ("U", mktime(0,0,0,$tmo,$tda,$tyr)-(intval(date("O", mktime(0,0,0,$tmo,$tda,$tyr)))*36))/86400))); // TODAY'S DAY NUMBER
...
//$daycount = (intval((date ("U", mktime(20,0,0,$mo,1,$yr))/86400)))-$ds; // FIRST OF MONTH DAY NUMBER
$daycount = (intval((date ("U", mktime(0,0,0,$mo,1,$yr)-(intval(date("O", mktime(0,0,0,$mo,1,$yr)))*36))/86400)))-$ds; // FIRST OF MONTH DAY NUMBER
and
Code:
//$start = intval(strtotime ($es[$i])/86400)+1;
//$end = intval(strtotime ($ee[$i])/86400)+1;
$start = intval(strtotime ($es[$i])/86400);
$end = intval(strtotime ($ee[$i])/86400);
Should I have changed anything else ?
I have tested my version with the dates that you say caused problems (eg, June 1, 2003 , April 7th 2003, October 27 etc), and none of them cause me a problem.

Now, as far as I can recall, the only difference between my instance and the original code is the following:
Code:
while ($i < $smc) {
	$es[$i] = ereg_replace('-','/', $es[$i]);
	$ee[$i] = ereg_replace('-','/', $ee[$i]);
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//$start = intval(strtotime ($es[$i])/86400)+1;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//$end = intval(strtotime ($ee[$i])/86400)+1;

	if (date("I", strtotime ($es[$i]))) {
 &nbsp;$start = intval(strtotime ($es[$i])/86400)+1;
	} else {
 &nbsp;$start = intval(strtotime ($es[$i])/86400);
	}
	if (date("I", strtotime ($ee[$i]))) {
 &nbsp;$end = intval(strtotime ($ee[$i])/86400)+1;
	} else {
 &nbsp;$end = intval(strtotime ($ee[$i])/86400);
	}

	if (!$ee[$i]) $end=$start; // MARK SINGLE DAY WITH ONLY ES VARIABLE
	if (!$bgc[$start]) {
 &nbsp;$bgc[$start]=1;
	} else {
 &nbsp;$bgc[$start]=4;
	}
	$bgc[$end]=3;
	for ($n = ($start+1); $n < $end; $n++) {
 &nbsp;$bgc[$n] = 2;
	}
	$i++;
}
If you still have further queries, let me know and we can try and work out why one fix works for me and not others.

Rich
 

Old 06-30-2003, 06:28 AM   #22
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

Hi Ricur,

The if clause you added is what's messing it up...
Code:
if (date("I", strtotime ($es[$i]))) {
 $start = intval(strtotime ($es[$i])/86400)+1;
} else {
 $start = intval(strtotime ($es[$i])/86400);
}
if (date("I", strtotime ($ee[$i]))) {
 $end = intval(strtotime ($ee[$i])/86400)+1;
} else {
 $end = intval(strtotime ($ee[$i])/86400);
}
it's not needed to do that anymore. You can completely remove that section and replace it with
Code:
$start = intval(strtotime ($es[$i])/86400);
$end = intval(strtotime ($ee[$i])/86400);
If you read what I did in Style 3, you'll see that I had commented that modification out

Here's Style 2
Code:
//$start = intval(strtotime ($es[$i])/86400)+1;
//$end = intval(strtotime ($ee[$i])/86400)+1;
$start = intval(strtotime ($es[$i])/86400)+!date("I", strtotime ($es[$i]));
$end = intval(strtotime ($ee[$i])/86400)+!date("I", strtotime ($ee[$i]));
And here's Style 3
Code:
$start = intval(strtotime ($es[$i])/86400)+1;
$end = intval(strtotime ($ee[$i])/86400)+1;
//$start = intval(strtotime ($es[$i])/86400)+!date("I", strtotime ($es[$i]));
//$end = intval(strtotime ($ee[$i])/86400)+!date("I", strtotime ($ee[$i]));
And here's the final Style 4
Code:
//$start = intval(strtotime ($es[$i])/86400)+1;
//$end = intval(strtotime ($ee[$i])/86400)+1;
$start = intval(strtotime ($es[$i])/86400);
$end = intval(strtotime ($ee[$i])/86400);
I'm pretty confident that if you remove that if clause, it will now display correctly. You might want to try 3.2 in it's original form and see if it displays right.

Let me know if there's any problems after that.

Gervais

PS: Testing should be done with hardcoded dates.
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 07-01-2003, 12:26 PM   #23
ricur
Calendar User
 
ricur is offline
Join Date: Jun 2003
Posts: 11
Default

Hi again all.
Where I am in BST time zone, we still have this bug.
I have just downloaded version 3.2 and made one change to it... I added :

Code:
$es = "2 Jul 2003";
$ee = "3 Jul 2003";
When testing this, July 1st,2nd, and 3rd are highlighted.
To work out what was wrong, I also print the daynumber in each field on the calendar.
The result of this is that I get the following day numbers:

1 12233 2 12234 3 12235

When comparing it to ve9gra's sample at http://ve9gra.gotdns.org/reuse/calendar/year4.html, the 1st of July (according to ve9gra) is 1-12234, the second is... 2-12235 3-12236 etc.

Any ideas - I am totally stumped now.

Rich
 

Old 07-01-2003, 08:20 PM   #24
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

Hi Richard,

I have found the problem and am working on it. I'm now testing almost all timezones with and without DST. I want to make sure that this next "fix" will be the last one!

Gervais
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 07-01-2003, 10:18 PM   #25
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

Ok, now this should do it..... (this is what happens when there's not enough testing).

For some reason my last fix was working for my timezone..... but now that I've looked thoroughly at it, I don't understand why... :P

I don't really know all the steps I took, as I was working on something else than the calendar to debug this... so I found a few bugs, but don't remember the order I found them in...

Anyways, first, I found a bug in my last fix..... my code was wrong..... i had to ADD the timezone difference, NOT SUBTRACT it... so first fix
Code:
//$tnum = (intval((date ("U", mktime(0,0,0,$tmo,$tda,$tyr)-(date("O", mktime(0,0,0,$tmo,$tda,$tyr)))*36)/86400))); // TODAY'S DAY NUMBER
$tnum = (intval((date ("U", mktime(0,0,0,$tmo,$tda,$tyr)+(date("O", mktime(0,0,0,$tmo,$tda,$tyr)))*36)/86400))); // TODAY'S DAY NUMBER

//$daycount = (intval((date ("U", mktime(0,0,0,$mo,1,$yr)-(date("O", mktime(0,0,0,$mo,1,$yr)))*36)/86400)))-$ds; // FIRST OF MONTH DAY NUMBER
$daycount = (intval((date ("U", mktime(0,0,0,$mo,1,$yr)+(date("O", mktime(0,0,0,$mo,1,$yr)))*36)/86400)))-$ds; // FIRST OF MONTH DAY NUMBER
Now I wanted to make sure that the days to be marked matched the days on the calendar... so I made it display that too...
It's now in the format of
<current day>-<using daycount calculation>:<daycount>
I used this as the daycount calculation
Code:
$mydate = intval((strtotime($mo."/".$cd."/".$yr))/86400);
This was taken on my server using ADT (Atlantic Daylight)
http://ve9gra.gotdns.org/reuse/calendar/year5.html

You can see that they all match, year round... but I wanted to make sure that it worked on other timezones, so I took this one was from my server too but using BST (British Summer)
http://ve9gra.gotdns.org/reuse/calendar/yearBST.html

You can see that anything between March 31, to Oct, 26 is messed up....

Then I figured the problem was with the marking routine... here's what I changed there
Code:
//$start = intval((strtotime($es[$i]))/86400);
//$end = intval((strtotime($ee[$i]))/86400);
$start = intval((strtotime($es[$i])+(date("O", strtotime($es[$i]))*36))/86400);
$end = intval((strtotime($ee[$i])+(date("O", strtotime($ee[$i]))*36))/86400);
Here's the result on my server again using ADT
http://ve9gra.gotdns.org/reuse/calendar/year6.html

You can see that there isn't any difference from year5... so it's still ok, but now... testing with BST
http://ve9gra.gotdns.org/reuse/calendar/yearBST2.html

WHOO HOO... same result!!

I tested almost every timezone, using both DST and standard time... Results are all the same. So this should be fine for everyone.

Richard, I'm really hoping this one will be the one. Please let me know ASAP if it's working for you.

Papa, I guess I should've done more testing before saying it was good to go (the last fix)..... but this one should be good. At least better than the previous one. I guess it's time for another release
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 07-01-2003, 10:27 PM   #26
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,878
Default

You have more time on your hands than I do!

If Rich says that it works then I'll make the appropriate changes to the script.
__________________
-- Brian

Questions?

Instructions: Version 6 - Version 7 | FAQ | Errors FAQ | Paths FAQ | Forums | Support
| Web Site Hosting
 

Old 07-02-2003, 04:19 AM   #27
ricur
Calendar User
 
ricur is offline
Join Date: Jun 2003
Posts: 11
Default

Hi again.
Unfortunately, this fix does not work for me.
I have even more info on what is causing it now (I think).

Yesterday, the date was 1st July 2003, and when I tried to mark the dates 2nd - 3rd July, it also marked the 1st July. HOWEVER, if I told it to mark the 2-3rd of August aswell, this worked fine (ie, it didnt mark the 1st August).

Now, today is 2nd July, and when I view yesterdays code again, still asking it to mark only the 2nd - 3rd July, this works fine.

If I change my date to be the 1st August 2003, and ask it to still mark the 2nd-3rd July and 2-3rd of August, the calendar will mark the 1st August aswell as the 2nd - 3rd August, but still gets July correct.

Now, I guess you are all thinking that I am just being stupid and it is highlighting these invalid dates as they are the current day, but I have set $nt = 1; so this is not the problem.

It seems to be that on the 1st of the month, it goes wrong.
The day numbers are still correct, eg, 1st August = 12265 2nd = 12266 3rd = 12267 it is just that it is highlighting the 1st of the month when it shouldnt

Any more ideas ?

Richard
 

Old 07-02-2003, 07:17 AM   #28
ricur
Calendar User
 
ricur is offline
Join Date: Jun 2003
Posts: 11
Default

I am back again (hopefully for the last time on this thread).

The problem I reported in my previous post was all my own doing
I was causing the bug when I was constructing my list of dates to mark on the calendar - I had a trailing "x" which created an additional value in the array (all be it an empty value). This led to the code using the 1st of the month.

I have fixed my code, implemented your patch, and it works fine (at least it appears to work fine so far).

I would say to apply this patch now to the downloadable version.

Thanks a lot for your efforts in fixing this.

Richard
 

Old 07-02-2003, 07:36 AM   #29
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

Wow, am I ever glad that it is now working for you Richard!! If it hadn't worked, I wouldn't have known where to look anymore...
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 07-02-2003, 12:17 PM   #30
ricur
Calendar User
 
ricur is offline
Join Date: Jun 2003
Posts: 11
Default

Well, thankyou very much for your patience and perseverance.

Richard
 
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add Event Id to Event Listing islandwood General Support 3 09-18-2007 09:38 AM
Can't delete an event Arthur General Support 1 07-18-2005 08:46 AM
{Fixed} Problem adding an event ucb General Support 23 11-19-2003 06:31 PM



All times are GMT -4. The time now is 07:39 PM.


vBulletin skins developed by: eXtremepixels
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright 2009 NashTech, Inc.

| Home | Register | Today's Posts | Search | New Posts |