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
- Site default timezone
Europe/Vienna, user timezones configurable. - A bundle with a date-only field, a trigger and a template with Date reached on that field, part end, no offset.
- Save an entity with the date 2030-05-10 as a user whose timezone is
America/New_York. - The tracking row's
next_checkis 2030-05-10 23:59:59 New York (2030-05-11 05:59:59 Vienna). Saved by a user inEurope/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.
Issue fork conditional_notification-3635036
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
Comment #5
daniel.pernold commentedReleased in 2.0.0-alpha29.