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?

Issue fork smart_date-3411060

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

FrankieD3 created an issue. See original summary.

frankied3’s picture

Issue summary: View changes
frankied3’s picture

Issue summary: View changes
himanshu_jhaloya’s picture

Assigned: Unassigned » himanshu_jhaloya

himanshu_jhaloya’s picture

Assigned: himanshu_jhaloya » Unassigned
Status: Active » Needs review

Created MR. fixed the user timezone. Please review