Skip to content

Workspace timezone and date & time format settings - #312

Open
gynsus wants to merge 4 commits into
trypostit:mainfrom
gynsus:pr/workspace-timezone
Open

Workspace timezone and date & time format settings#312
gynsus wants to merge 4 commits into
trypostit:mainfrom
gynsus:pr/workspace-timezone

Conversation

@gynsus

@gynsus gynsus commented Aug 30, 2026

Copy link
Copy Markdown

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's timezone:all): a select on Settings → Workspace listing Intl.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.
  • Calendar bucketing follows it: PostController@calendar groups 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 central formatDate/formatTime/formatDateTime helpers, with live example labels in the select.
  • Drafts in the post lists show their last-edited date instead of an em dash.
  • A WorkspaceSettingsTranslationTest asserts 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 an Australia/Brisbane workspace managed from Europe.

gynsus added 4 commits August 30, 2026 16:02
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.
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.

1 participant