Very annoying error - when you have a date with timezone, it is never loaded in the widget. The problem is obvious and fix is trivial. In date_widget replace these lines:

          'timezone_out' => ($items[$delta]['value'] && $param['required'] ? $timezone : ''),
          'timezone_in'  => ($items[$delta]['value'] && $param['required'] ? 'GMT' : ''),

With these:

          'timezone_out' => ($items[$delta]['value'] && $field['required'] ? $timezone : ''),
          'timezone_in'  => ($items[$delta]['value'] && $field['required'] ? 'GMT' : ''),

$param['required'] was being used before getting initialized...

Comments

dkruglyak’s picture

Another issue. Seems like even with this fix the timezone loads only when Date field is set to required.

I have no idea why this setting was there to begin with... I think what is needed instead is ability to use a "default" timezone (e.g. sitewide timezone set in date field), when it is not entered. GMT default is very bad from user perspective...

karens’s picture

I'll have to dig into this one, but I'll explain a couple of things:

The use of GMT here is because the timezone in is coming from the database where the date was stored in GMT. And you do set the sitewide timezone the first time you set up a date field. After you first set it up, the setting drops down into a collapsed fieldset so you are not presented with it over and over, but it is still there and it can be changed if wrong.

dkruglyak’s picture

This is a big usability problem.

Non-techie user does not care how the date is stored in DB, they always want to see it in the way relevant to them.

So if timezone is not set in DB explicitly, it should be converted to user's or at least site's DB when loaded...

Even whenever a timezone is set in DB, there should be an option to load it converted to user's timezone.

Worth really rethinking how this works.

karens’s picture

Status: Reviewed & tested by the community » Fixed

The original item is fixed in all branches. On the other question, you are misunderstanding what that bit of code does. It is bringing the value out of the database and converting it to the appropriate timezone. The 'GMT' is to show that the staring point of the value is GMT since it's coming from the database. That is not what the user sees or uses.

Anonymous’s picture

Status: Fixed » Closed (fixed)