Default date field settings ignore sitewide timezone

Created on 27 December 2023, 12 months ago
Updated 22 February 2024, 10 months ago

Problem/Motivation

When the default date setting for a smart date field is set to a relative date, e.g. "Tomorrow Noon", the site's timezone is ignored and UTC is used.

I have worked around this by appending the timezone to the end of the string, which works, but feels a bit hacky. E.g. "Tomorrow Noon America/New_York"

Steps to reproduce

During the creation or editing of a smart date field, within the default value section, select "relative date" for the default date select list.

Set the relative default value field to a value such as "Tomorrow Noon" and save the settings.

Inspect the field when creating new content and see that the default date is using UTC.

Proposed resolution

I would suggest rendering out the default date by default in the current user's timezone. I am not versed well enough in the smart date source to take a crack at this.

Checking if a timezone has been included in the string would be handy, but not required. Perhaps there's a better solution to this? A secondary select list to choose the timezone for the relative date, perhaps?

🐛 Bug report
Status

Needs review

Version

4.0

Component

Code

Created by

🇺🇸United States FrankieD3

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024