PHP Classes

Two bugfixes

Recommend this page to a friend!

      PHP Day Light Calculator  >  All threads  >  Two bugfixes  >  (Un) Subscribe thread alerts  
Subject:Two bugfixes
Summary:Wrong check on date('G') and sunrise/sunset hours are excluded.
Messages:2
Author:Filip Komar
Date:2020-04-11 14:02:58
 

  1. Two bugfixes   Reply   Report abuse  
Picture of Filip Komar Filip Komar - 2020-04-11 14:02:58
First I would like to thank you for this class.
I noticed two different bugs though.

First is that date('G') according to php documentation returns integers from 0 to 23.
The second one is that sunrise and sunset hours are excluded.

The fixes are simple. Line:
if($now<$Msunrise && $now>=1){ //before sunrise
should be:
if($now<=$Msunrise && $now>=0){ //before sunrise

and second line:
elseif($now>$Msunset && $now<=24){ //after sunset
should be:
elseif($now>=$Msunset && $now<=23){ //after sunset

  2. Re: Two bugfixes   Reply   Report abuse  
Picture of Dannel Dannel - 2020-04-11 15:30:58 - In reply to message 1 from Filip Komar
Thanks