Project

General

Profile

Actions

Bug #3530

closed

Dates are not storing properly with a timezone specified

Added by krileon almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
18 May 2012
Due date:
% Done:

100%

Estimated time:

Description

When you specify a timezone the offset doesn't calculate properly. Dates are being stored with date( 'Y-m-d' ) and Joomla changes how this PHP function behaves by changing the timezone globally. A new function is needed to change the timezone to UTC, prepare the date, then change it back to whatever it was (this method can be seen in the author content plugin).

Actions #2

Updated by krileon almost 12 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

Implemented 3 new functions: getUTCDate (date), getUTCTimestamp (strtotime), and getUTCNow (time) to return UTC values and avoid Joomlas alteration of the default PHP timezone. This helps ensure dates, times, and comparisons are all done properly with UTC. The only time timezone is applied is on display (as it should be).

Events integration always outputs as UTC to ensure the time you specified and the time stored to database is always output. So if you select 1:00 PM it will display as 1:00 PM. Doing anything otherwise will just cause problems as lets say we store the value as UTC then output with timezone the user selected 1:00 PM, but now it displays as 5:00 PM, which is very confusing; then other users could see it as 3:00 PM, etc.. it'd make no sense. Instead it'll output as 1:00 PM and you determine its time relevant to your self based off the location of the event. Note it already displays like this so no one will notice this internal change (it just avoids Joomla from screwing up the dates and times).

Actions #3

Updated by krileon almost 12 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF