Ticket #288 (new defect)

Opened 2 months ago

Timezone Bug in Solar_View_Helper_Timestamp (DST)

Reported by: mjaschen <mjaschen@…> Owned by: pmjones
Priority: major Component: code
Keywords: timezone, helper, timestamp, view, dst Cc:

Description

I discovered a bug in timezone calculation in Solar_View_Helper_Timestamp.

Assume the following conditions:

  • tz_origin is UTC
  • tz_output is Europe/Berlin
  • Timestamp is 2010-01-01 00:00:00

This timestamp is converted by the Timestamp helper to 2010-01-01 02:00:00 (2 hours difference). This is wrong.

2 hours is the DST difference, but in January DST isn't active. The correct result would be 2010-01-01 01:00:00.

The reason: the timezone offsets are calculated at construction time for the current timestamp and not for the given timestamp. See Solar/View/Helper/Timestamp.php lines 127, 135:

$origin_date = new DateTime('now', $origin_tz);

I think, the offset calculation cannot be done at construction time. The offsets must be recalculated at each call to Timestamp::timestamp().

Attachments

Add/Change #288 (Timezone Bug in Solar_View_Helper_Timestamp (DST))

Author


E-mail address and user name can be saved in the Preferences.


Action
as new
 
Note: See TracTickets for help on using tickets.