Workspace timezone and date & time format settings - #312
Open
gynsus wants to merge 4 commits into
Open
Conversation
A nullable IANA timezone on the workspace (Settings → Workspace). When set, every date the app renders or schedules — the calendar, the post lists (all/scheduled/posted/drafts) and the schedule picker — uses it via the shared date module's getUserTimezone(); empty keeps the pre-setting behavior (the viewer's browser timezone). Shared through the auth Inertia props so the whole team sees the same wall-clock times.
The calendar grouped posts into days by their UTC date (the $tz seam was hardcoded to 'UTC'), so with a workspace timezone set an evening post still appeared on the previous/next day. Day navigation, the query range and the day keys now all use the workspace timezone; without the setting the behavior is unchanged.
A datetime_format preset on the workspace (Settings → Workspace, next to the timezone): 24h/12h day-month, dotted and slashed variants, or auto — the locale defaults, the pre-setting behavior. The shared date module applies the preset to formatDate/formatTime/formatDateTime, so the calendar and every post list render one consistent format. The posts table also falls back to updated_at for drafts instead of an em dash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A workspace is usually a brand with a home market; the people scheduling for it are often somewhere else. Today every date in TryPost renders in each member's browser timezone, so the calendar, the post lists, and "scheduled for 9:00" mean something different to every member — and the calendar day-buckets were hardcoded to UTC on the backend, so a post scheduled for 23:30 local showed up under the wrong day.
What changed
workspaces.timezone(IANA name, nullable = "auto: browser timezone", validated with Laravel'stimezone:all): a select on Settings → Workspace listingIntl.supportedValuesOf('timeZone'). When set, all date formatting client-side goes through it (getUserTimezone()prefers the workspace value), so every member sees the same wall-clock times.PostController@calendargroups posts into days by the workspace timezone instead of the previously hardcoded UTC.workspaces.datetime_format— four display presets (DD MMM YYYY, 24h,DD MMM YYYY, 12h,DD.MM.YYYY, 24h,MM/DD/YYYY, 12h, null = locale default), applied by the centralformatDate/formatTime/formatDateTimehelpers, with live example labels in the select.WorkspaceSettingsTranslationTestasserts the new settings keys exist in every locale (all 16 shipped).Testing
WorkspaceControllerTest(setting validation/persistence),PostControllerTest(calendar bucketing by workspace tz), and the translations test pass. Running live on a self-hosted instance with anAustralia/Brisbaneworkspace managed from Europe.