Generated with the help of an LLM.

Problem/Motivation

For a field with datetime_type: date, Date reached builds the start (00:00:00) and the end (23:59:59) of the day with date_default_timezone_get(), i.e. in the timezone of the current request. On the save path the evaluation runs as the user who saved the entity, so with configurable user timezones that is the saving user's timezone, not the site's. The same template schedules the same date at different moments depending on who saved the entity.

The README says "A date without a time starts at 00:00 and ends at 23:59:59 in the site timezone".

Steps to reproduce

  1. Site default timezone Europe/Vienna, user timezones configurable.
  2. A bundle with a date-only field, a trigger and a template with Date reached on that field, part end, no offset.
  3. Save an entity with the date 2030-05-10 as a user whose timezone is America/New_York.
  4. The tracking row's next_check is 2030-05-10 23:59:59 New York (2030-05-11 05:59:59 Vienna). Saved by a user in Europe/Vienna, it is 2030-05-10 23:59:59 Vienna.

Proposed resolution

Read the day in the site's default timezone (system.date:timezone.default, falling back to date_default_timezone_get() when it is empty). Inject config.factory into the plugin. Kernel test in FieldConditionsTest that sets a different request timezone and expects the site's day.

Remaining tasks

  • Review.

User interface changes

None.

API changes

None.

Data model changes

None. Rows already scheduled keep their next_check until the entity is saved again.

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

tkasecker created an issue. See original summary.

  • tkasecker committed 6fcde504 on 2.0.x
    Issue #3635036: Read a date-only field in the site's timezone in Date...

  • daniel.pernold committed ebd110d5 on 2.0.x
    chore: add the changelog for the 2.0.0-alpha29 release
    
    - Move the...
daniel.pernold’s picture

Status: Active » Fixed

Released in 2.0.0-alpha29.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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