MyBB Community Forums

Full Version: Fixing the date/time "bug"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My search with respect to how MyBB keeps track of time has indicated problems going back many years.  The most recent posting I saw was in 2015, with an acknowledgment the problem still existed.  However that discussion, Time of posting changed after DST went back to standard time #1781 , ended with this "Closing this because we haven't found a solution to this problem."

With no evidence to the contrary, I assume this problem still exists and there is no real effort to fix it.  Part of the issue is I am not sure the probelm has been correctly identified.  Most of the code is centered around an offset to GMT.  While this may be appropriate in some cases, what is wanted in most places is a timezone specification (and the two are different, mostly because of Daylight Savings Time).  Consider the user who sets their timezone to GMT -2 and then turns on DST.  That is the exact same thing as just setting the timezone to GMT -1.  Either way, one is just setting an offset value.

The isse is perhaps best illustarted looking at setting the time for a repeated event.  One cannot specify a timezone, only an offset to GMT (and this is effectively what one is doing even if one uses the timezone offset value associated with the user).  But these events can have different offsets in play for the start and end time specified (because one is before and one is after DST).

There is a setting for automatic DST detection but its premise is flawed because it is implmented for setting a single static offset (again, internally, MyBB thinks of date/time in terms of an static offset).  But DST automatic correction is not static, it will be different depending on when in the year an particular date/time falls.  The same offset may not be correct for both the start and end times of an event, for example.

This is not a difficult problem to solve, PHP has functions that handle all the converversion automatically.  There may be many place in MyBB code where correction is needed, but it does not appear to me to be too difficult.

Which brings me to the quote cited above, "Closing this because we haven't found a solution to this problem."  I do not know how one becomes a contributor to this effort, but I can find a solution to this problem.  I am willing to do the work.  If this has not already been fixed or has someone working on it, I am volunteering my effort and expertise to get this corrected.  Lets get this taken care of.
AFAIK, no one is working on it at present & efforts to improve MyBB would be welcomed ..
I could have sworn I made a suggestion for 2.0 to use timezone names (such as America/Denver) instead of just an offset.
(2018-03-01, 05:53 PM)laie_techie Wrote: [ -> ]I could have sworn I made a suggestion for 2.0 to use timezone names (such as America/Denver) instead of just an offset.

I remember seeing such a suggestion.

There is nobody working on changes to times as far as I'm aware, so we'd welcome any Pull Requests to improve how things work for definite. In my eyes, dates should always be stored in the UTC timezone, and coverted to user local time on display. Ideally we'd also convert all of the date type columns in the database to use actual Date Time column types, rather than just integer timestamps.