webcalendar icon indicating copy to clipboard operation
webcalendar copied to clipboard

November has 2 x Sunday the 3rd

Open ogs22 opened this issue 5 years ago • 2 comments

as seen here: http://webcalendar.sourceforge.net/demo/view_m.php?id=935&date=20191101

view_m.php repeats the Sunday as it loops thru using date + 86400 - which doesn't account for the hour change when DST ends

http://shrunk.com/cal-error.png screenshot

ogs22 avatar Sep 16 '19 09:09 ogs22

Slightly crappy fix by testing if we've gained or lost an hour

for ( $date = $startdate; $date <= $enddate; $date += 86400 ) {
    //date should always be 00 hours entering DST turns this into 01 (end of March)
    //leaving DST turns into 23 (end of October)
    $DSTtest = date("H",$date);
    if ($DSTtest == "23") {
      $date = $date + 3600;
    } 
    if ($DSTtest == "01" ) {
      $date = $date - 3600;
    }
    
    $dateYmd = date ( 'Ymd', $date );

https://github.com/craigk5n/webcalendar/blob/master/view_m.php#L133

ogs22 avatar Sep 16 '19 11:09 ogs22

Crappy fix, but works, to get the double day away, thanks

grzchr15 avatar Sep 16 '19 18:09 grzchr15