Skip to content

Conversation

@duncanmcclean
Copy link
Member

This pull request fixes an issue with default: now on Date fields (we use default: now on dated entries).

Currently, the date fieldtype's preProcess method returns the current time in UTC. This works fine when time_enabled: true.

However, when it is false, we need to get midnight in the client's timezone, which we can only do in JavaScript. We can re-use the addDate method for this (it's currently used when you click "Add Date" on an optional date field).

Because setting the field's value will make the page dirty, I've added a line to ensure the publish container's dirty state is cleared on the next tick, avoiding unnecessary dirty state warnings.

Fixes #12585

So that when we get midnight, we're getting midnight in the user's timezone and not midnight in UTC.
@duncanmcclean duncanmcclean linked an issue Nov 13, 2025 that may be closed by this pull request
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.

[6.x] Different date field behaviour

2 participants