New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply DST based on the timestamp instead of the current date. #1778
Conversation
// If DST correction is enabled, add an additional hour to the timezone. | ||
if($dstcorrection == 1) | ||
// If DST correction is enabled and the date falls into DST, add an additional hour to the timezone. | ||
if($dstcorrection == 1 || ($dstcorrection == 2 && date('I', $stamp) == 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there are several different rules regarding daylight saving time (and countries not having it at all), it don't think date('I', $stamp) is reliable. It will always apply the British DST rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you are right. Sadly there is no real way to reliably query DST for specific timezones/locations in PHP (that I am aware of). And if there were, it would require users to also tell the country that they live in. :/
So you can probably just close the pull request then and I'll just keep using this method for my forum, where I can rely on almost all guests being from the northern hemisphere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't something like this work? http://stackoverflow.com/a/14423394/1708567 We set it to GMT everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but we can't map our timezones (just +1, -5,...) to those timezones...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.. So no solution for this or?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably something we should defer to 2.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably for the best. 2.0 needs a user setting for the country that would be considered for DST calculations at this point.
Related thread on the forums: http://community.mybb.com/newreply.php?tid=162091
When "my_date" applies DST in "Automatically detect DST"-Mode (value 2), it doesn't check/respect the timestamps value at all and simply applies DST always/never, based on the current time. This is certainly wrong and potentially confusing, as it retroactively changes the displayed post timestamps (and other dates) whenever the current date switches to/from DST.