The calendar block "Calendar to browse events." shows this month (october 2008) correctly, but has the day of the week out by one on next month

See:
http://wellington.geek.nz/event/2008/11/28/month/all/all/1

1st of November is a saturday, not a sunday.

CommentFileSizeAuthor
#7 event.module_67.patch737 bytesShiny
#3 event.module.patch737 bytesShiny

Comments

rimu’s picture

yeah i'm getting this too

Shiny’s picture

we're now in November -- and dates in November are still one day out -- November 1st 2008 appears as a Friday, but it's not.

Shiny’s picture

StatusFileSize
new737 bytes

Worked it out -- the code was assuming nobody is > 12 hours past GMT -- and here i am @ GMT+13

changed a mktime to a gmmktime, and then the line of code is now using all timestamps in GMT.

Shiny’s picture

Status: Active » Needs review
lyricnz’s picture

I understand that the gmdate/date needs to match the TZ of the gmmktime/mktime (the real bug), but why change the hour to 13?

 function _event_day_of_week($date) {
-  $dow = gmdate('w', mktime(12, 0, 0, $date['month'], $date['day'], $date['year']));
+  $dow = gmdate('w', gmmktime(13, 0, 0, $date['month'], $date['day'], $date['year']));
   $dow = (variable_get('date_first_day', 1) ? ($dow == 0 ? 6 : --$dow ) : $dow);
   return $dow;
 }
killes@www.drop.org’s picture

Status: Needs review » Postponed (maintainer needs more info)
Shiny’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new737 bytes

@lyricnz whoops.. the +13 happened during my debugging.
Patch rerolled with 12, and tested to confirm it fixes this error for timezones >12 ahead of UTC

lyricnz’s picture

Status: Needs review » Reviewed & tested by the community

I tested this previously, works for me.

gerhard killesreiter’s picture

Status: Reviewed & tested by the community » Fixed

Applied to D6 and D5.2.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.