Skip to content

[6.x] Add configurable timezone for date fields in the Control Panel#14554

Open
duncanmcclean wants to merge 13 commits into6.xfrom
date-field-timezones
Open

[6.x] Add configurable timezone for date fields in the Control Panel#14554
duncanmcclean wants to merge 13 commits into6.xfrom
date-field-timezones

Conversation

@duncanmcclean
Copy link
Copy Markdown
Member

@duncanmcclean duncanmcclean commented Apr 27, 2026

This PR adds a timezone option to the Date fieldtype, allowing dates in the Control Panel to be displayed and entered in a specific timezone rather than always using the browser's local timezone.

This is useful when you want all users to use the same timezone, wherever they are physically located.

You can either configure a default timezone for all Date fields across your site, or on a per-field basis:

Site-wide default

This PR adds a default_timezone config option to config/statamic/cp.php.

It defaults to auto (browser's timezone) but can be set to any IANA timezone (e.g. America/New_York) to pin all date fields to that timezone by default:

'default_timezone' => env('STATAMIC_CP_DEFAULT_TIMEZONE', 'auto'),

Per-field override

Individual date fields can override the site-wide default via a new "Timezone" config option in the field's settings:

CleanShot 2026-04-27 at 14 52 34

Closes statamic/ideas#1453
Closes statamic/ideas#1441

duncanmcclean and others added 13 commits April 27, 2026 14:00
Add a per-field `timezone` config option and a site-wide
`statamic.cp.date_timezone` config so dates can be pinned to a specific
timezone instead of always using the browser's local timezone.

Resolution order: field config > cp.date_timezone > browser local.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update the frontend to treat 'auto' as the signal for browser-local
timezone, matching the refactored resolvedTimezone() which always
returns a string.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The DateIndexFieldtype now receives the resolved timezone and uses it
with Intl.DateTimeFormat so listing views display dates in the
configured timezone.

The timezone config field's placeholder now shows the CP default
timezone instead of "Auto" when one has been configured.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The dictionary fieldtype may return an array value even with
max_items set to 1. Handle both array and string cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The tooltip was always using timeStyle: 'long' which showed a
misleading time even for date-only fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add a static presets getter to DateFormatter instead of duplicating
the preset objects in the index fieldtype component.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The replicator preview was always using browser-local timezone
formatting. Now it respects the field's configured timezone via
the displayTimezone computed property.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The instance #presets field was duplicating the static presets getter.
Now #normalizeOptions references DateFormatter.presets directly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Allow setting an entry publication date field to show the site timezone rather than localise Allow date fields to ignore browser localization

1 participant