Action to set a date-and-time value doesn't consider timezone

Created on 13 September 2022, over 2 years ago
Updated 14 March 2023, almost 2 years ago

Problem/Motivation

I use the action 'Entity: set field value' to set NOW as value into a date-time field. The date and time is set but it is 2 hours in the future.

Steps to reproduce

The format [current-date:html_datetime] (=> 2022-09-13T21:49:37+0200) causes an error (SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_…).

So I give into the action a token in the format
2022-09-13T22:18:28 (without +0200).

For controlling the token output I use the action `Display a message`. This shows:
2022-09-13T22:28:56

however the set value is:
2022-09-14T00:28

So I assume the reason is that the action doesn't consider timezone and I think this is a bug.

Proposed resolution

I expect that setting a date does consider the timezone of the current user or to have that configurable.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Fixed

Version

1.1

Component

Documentation

Created by

πŸ‡©πŸ‡ͺGermany marco.b

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States sgroundwater

    I am also struggling with how to factor for Time Zones.

    In the above sample model, the date is a hard coded value. The value does not come from an actual field.

    With ECA, when setting a token value from a date field, the value is set as UTC. Outside of ECA, date fields use a view format, which is where you can set a time zone.

    I am trying to figure out if I can set a model token, using an existing date field, where the field's display uses my display/timezone format.

    It may be possible to create a custom action to help re-calculate a Unix Timestamp based on a static timezone. ( This seems super messy and wrong.)

    I feel like I'm missing some easy trick for using date fields.
    I welcome any tips.

    Big thanks for ECA, it is an incredible tool!

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    I'm going to respond in the Slack channel on this. Commenting on closed issues is no good idea. Better starting a new issue in such cases.

Production build 0.71.5 2024