Kinsbane Posted August 5, 2009 Share Posted August 5, 2009 So, I didn't program this class and I've always had trouble figuring it out. We moved our site to a new server and now some months have incorrect dates on incorrect days (usually only off by one day/date). So, here's how it works. A query on the events table is run that grabs all events. It then runs a while loop and adds the dates it finds for the current month and year into the $cal object, like so: while($data = mysql_fetch_array($result, MYSQL_ASSOC)) { if($data['event_date'] > $month_start and $data['event_date'] < $month_end) { $cal->add_event($data['event_title'], $data['event_date'], $data['event_length'], "events/event/{$data['event_id']}", $data['event_status'], $data['event_id']); } } Then, the calendar is displayed: $body .= $cal->display(mktime(0,0,0,$month,1,$year)); The $cal->display() method generates an HTML string which is added to $body for output. I've tried all I can think of to fix this problem. You can see it further in the attachments I provided, which show October 2009, Nov 2009, and December 2009 - in this set of three, only November has the correct dates on the correct days. If you look at October, you'll see it shows the 31st being on a Friday, when it should be on a Saturday. I've also attached the class for people to look at. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/168991-i-need-to-figure-out-why-my-calendar-class-sucks-dates-are-off/ Share on other sites More sharing options...
Kinsbane Posted August 6, 2009 Author Share Posted August 6, 2009 Please, can anyone help me? I've now started getting lots of flak because people in my company trust this calendar (which is showing incorrect dates/days) rather than a different one. It's maddening. Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/168991-i-need-to-figure-out-why-my-calendar-class-sucks-dates-are-off/#findComment-892542 Share on other sites More sharing options...
Mardoxx Posted August 7, 2009 Share Posted August 7, 2009 may be a stupid question... but did you take into account leap years? Link to comment https://forums.phpfreaks.com/topic/168991-i-need-to-figure-out-why-my-calendar-class-sucks-dates-are-off/#findComment-892628 Share on other sites More sharing options...
Kinsbane Posted August 10, 2009 Author Share Posted August 10, 2009 may be a stupid question... but did you take into account leap years? You know, now that I think of it, no, I didn't, but maybe the other guy who programmed the class didn't think of that either? I was messing around with it more on Friday afternoon, and there's something wrong in general with November of this year - no events are showing up on the calendar after the first one, which starts on the 1st of November and the 1st of November is on the first day on the first week of the month. Halloween is on a Saturday, so the first would be the following Sunday. This year, however, isn't a leap year so I don't see how that would affect anything... Link to comment https://forums.phpfreaks.com/topic/168991-i-need-to-figure-out-why-my-calendar-class-sucks-dates-are-off/#findComment-895127 Share on other sites More sharing options...
Kinsbane Posted August 10, 2009 Author Share Posted August 10, 2009 And I really wish I could completely re-do the calendar functionality altogether. I am in love with these two calendar implementations: http://www.stefanoverna.com/log/create-astonishing-ical-like-calendars-with-jquery http://davidwalsh.name/dw-content/php-calendar.php ... but the folks here are stuck on being able to see events that span multiple days. I can appreciate it but I don't think it's drastically easier to read the event from a list rather than a colored bar and finding its subsequent match in a list of the events... Ugh, I dunno what to do. I just want this fixed and I Don't know how. Link to comment https://forums.phpfreaks.com/topic/168991-i-need-to-figure-out-why-my-calendar-class-sucks-dates-are-off/#findComment-895129 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.