Skip to content

[6.x] Avoid calling ->startOfDay() on date range dates#13865

Open
duncanmcclean wants to merge 1 commit into6.xfrom
date-range-augmentation
Open

[6.x] Avoid calling ->startOfDay() on date range dates#13865
duncanmcclean wants to merge 1 commit into6.xfrom
date-range-augmentation

Conversation

@duncanmcclean
Copy link
Member

This pull request avoids calling ->startOfDay() when augmenting date ranges to avoid situations where the user selects one date but it saves another, which may cause the wrong date to be displayed on the frontend.

For example: if you're in Germany and select the 2nd February, it'll save as 2026-02-01 23:00.

Related: #13839 (comment)

@ajnsn
Copy link
Contributor

ajnsn commented Feb 11, 2026

Hey @duncanmcclean — thanks for this PR. As this issue currently breaks the whole application on our end (all event date ranges are shifted by one day), we’d really appreciate it if this could be merged soon.

An alternative solution would be to set date_format: Y-m-d directly on the field, which seems causing the same issue ☺️ Do you know if this will be addressed by the augmentation change as well?

@duncanmcclean
Copy link
Member Author

duncanmcclean commented Feb 11, 2026

An alternative solution would be to set date_format: Y-m-d directly on the field, which seems causing the same issue ☺️ Do you know if this will be addressed by the augmentation change as well?

Even when this PR is merged, you shouldn't save date range dates in Y-m-d as Statamic needs the correct date & time in order to convert from your app's timezone (by default, UTC) into your browser's timezone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants