--- Comment #1 from John Morton <> 2011-02-08 11:56:37 
UTC ---
Created attachment 8108
Fix so that 'now' uses the wiki local timezone.

This patch fixes the 'now' not honouring the wiki set timezone by ensuring that
all uses of the date() function wrapped between calls to                  
date_default_timezone_set( $wgLocaltimezone ) and a reset to whatever the local
TZ was set to. 

(Using date_default_timezone_set seems to be more reliable than putenv; it's
what mediawiki itself does for timestamping.)

Works well for me with a couple of cavaets:

1) Due to the subclassing used, it's possible for the time part being one
second to midnight and the date part being the day at midnight if the call to
time() in the DateTime's 'now' section happens just before the second tick, and
the call to the parent class happens just after. A rare problem, but it does
suggest that processing the date/time into a data structure should happen
outside transforming it into form components, which is probably a good idea

2) The code for processing a datetime with str2time is untouched and needs to
set the specified timezone for the time translations not to munge the output, I
think. Hard to test, as SMW Date types don't like the timezones I've set.

Also, minor tweak: the timezone box is now size="3" to fit the likes of NZDT

Configure bugmail:
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Wikibugs-l mailing list

Reply via email to