Problem/Motivation

Dates saved with incorrect Timezone if User's timezone is different from the field value entered.

My site Timezone is set to America/Chicago.
Current User (Admin) Timezone is set to America/New York.
I have a recurring date field on an Event Content type.
I enter a date and time and set the timezone to America/Chicago.
The actual value in the database saves it to UTC, but as if it were America/New York tz not, America/Chicago.

I would expect if the timezone field is set, it should respect that setting. This seems to be the way the Simple Recurring Date Widget works.

Proposed resolution

Need to update DateRecurModularWidgetBase (I believe) to handle the correct timezone that is set on the field rather than the site or the user's timezone.

Remaining tasks

  • Identify where the problem is (individual widgets or the Widget Base)
  • Compare against the DateRecurBasicWidget
  • (I Believe) simply update the DateRecurModularWidgetBase

Comments

pingevt created an issue. See original summary.

pingevt’s picture

Issue summary: View changes
dpi’s picture

Title: Field Date value saved with incorrect Timezone » Alpha widget doesnt adjust time zone properly
Version: 8.x-1.0-alpha2 » 8.x-1.x-dev
Assigned: Unassigned » dpi

Confirmed issue.

Alpha widget is not adjusting user input to submitted time zone, instead it is UTC. Each widget does it a little differently, DR hijacks callback adding dateValueCallback to modify date_timezone live. Oscar creates date objects from raw user input.

dpi’s picture

Assigned: dpi » Unassigned
Status: Active » Needs review
StatusFileSize
new13.08 KB
new11.81 KB

Status: Needs review » Needs work

The last submitted patch, 4: 3074571-test-only.patch, failed testing. View results

  • dpi committed ba25486 on 8.x-1.x
    Issue #3074571 by dpi, pingevt: Alpha widget doesnt adjust time zone...
dpi’s picture

Status: Needs work » Fixed

Committed.

Thanks for the report.

dpi’s picture

Status: Fixed » Needs work

Actually loading values from storage is still a little wacky.

dpi’s picture

Status: Needs work » Needs review
StatusFileSize
new1.03 KB
new3.07 KB
dpi’s picture

Fixed test only patch, this should fail.

Status: Needs review » Needs work

The last submitted patch, 10: 3074571-form-values-loaded-invalid-test-only.patch, failed testing. View results

  • dpi committed de36e8d on 8.x-1.x
    Issue #3074571 by dpi: Fixed loading Alpha widget adjusts to users...
dpi’s picture

Status: Needs work » Fixed

Committed with tests. 💎

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

dexiecarla’s picture

Not the best solution, but it works for me for now.

Site timezone is set to 'Australia/Melbourne'

When setting/editing date during early morning AEST, the date saved is always converted to UTC which is expected & understandable.
Let say, I set June 8 2022, saved date is June 7 2022
However when editing the content after its saved, the date in the calendar is June 7 2022 so its not converted to AEST or whatever timezone is set in that date.
Continuing to edit and save the content even not modifying the value of the date, it keeps saving the date in UTC timezone.

So this patch is just converting the saved date appropriate timezone in the UI.