Skip to content

fix(frontend): honor the AM/PM date metric in the post date picker time input - #2031

Open
giladresisi wants to merge 1 commit into
stagingfrom
fix/date-picker-time-format
Open

giladresisi wants to merge 1 commit into
stagingfrom
fix/date-picker-time-format

Conversation

@giladresisi

Copy link
Copy Markdown
Collaborator

What kind of change does this PR introduce?

Bug fix (frontend, post editor date picker). The "Pick time" field inside the scheduling popup of the post editor is a Mantine TimeInput rendered without a format prop, so it always showed 24-hour time even when Settings > Date Metrics is set to AM:PM. This PR passes format={isUSCitizen() ? '12' : '24'} to that TimeInput in date.picker.tsx, matching the format the date button next to it already uses. The change handler, the calendar, and the 24-hour path are unchanged.

Why was this change needed?

A customer reported on 2026-09-04 that with Date Metrics set to AM:PM, the calendar and the editor's date button show "3:19 PM" while the time field inside the scheduling popup shows "15:19", so the UI mixes both formats. The setting is meant to apply to every time display.

Other information:

Support initially told the customer the 24-hour field was intentional to avoid overlapping schedules; nothing in the code supports that, the prop was simply never set.

QA

  1. Go to Settings > Global Settings and set Date Metrics to AM:PM
  2. Open the calendar, click Create Post, then click the date button at the bottom of the editor
  3. The "Pick time" field in the popup should show 12-hour time with an am/pm segment (e.g. "01 : 40 pm"), matching the date button
  4. Change the hour to 03 pm and close the popup; the date button should read "... 03:40 PM"
  5. Set Date Metrics back to 24 hours, reopen the popup; the field should show 24-hour time (e.g. "13 : 40") as before

Checklist:

Put a "X" in the boxes below to indicate you have followed the checklist;

  • I have read the CONTRIBUTING guide.
  • I have signed the Contributor License Agreement (CLA) (ICLA for individuals, CCLA for entities).
  • I confirm I have not used AI to submit this PR or generate code for it.
  • I checked that there were no similar issues or PRs already open for this.
  • This PR fixes just ONE issue
  • I have filled in the QA section above with real steps to verify this change.

🤖 Generated with Claude Code

https://claude.ai/code/session_0139MFpBVVACikM4kMYZ1F9F

…me input

The TimeInput inside the editor's date picker popup always rendered 24h,
ignoring the Date Metrics setting that the rest of the UI respects.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139MFpBVVACikM4kMYZ1F9F
@postiz-contribution postiz-contribution Bot added the contribution:approved Approved contributor label Sep 7, 2026
@strix-security

strix-security Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Strix Security Review

No security issues found.

Updated for c42dc08.


Reviewed by Strix
Re-run review · Configure security review settings

@postiz-agent

postiz-agent Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

/>
<TimeInput
onChange={changeDate('time')}
format={isUSCitizen() ? '12' : '24'}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The format prop is passed to a Mantine v5 TimeInput component, which does not support it. The prop will be ignored, and the time format will not change as intended.
Severity: MEDIUM

Suggested Fix

The TimeInput component does not support the format prop in Mantine v5. To control the time format, replace the TimeInput component with Mantine's TimePicker component, which does accept a format prop (e.g., format="12h" or format="24h").

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: apps/frontend/src/components/launches/helpers/date.picker.tsx#L76

Potential issue: The code passes a `format` prop to the Mantine v5 `TimeInput` component
to switch between 12-hour and 24-hour formats. However, the `TimeInput` component in
`@mantine/dates: "^5.10.5"` does not support the `format` prop. As a result, React will
silently ignore this prop, and the component will default to the browser's native
`input[type="time"]` behavior, which is typically a 24-hour format. The intended
functionality of displaying a 12-hour clock for certain users will not work, defeating
the purpose of the change.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not valid. The installed @mantine/dates is 5.10.5, and its TimeInput declares format?: '12' | '24' (node_modules/@mantine/dates/lib/components/TimeInput/TimeInput.d.ts). TimePicker does not exist in v5. Verified in the browser: the field renders "01 : 40 pm" with AM/PM selected and "13 : 40" with 24 hours.

This branch has not been deployed

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

Labels

contribution:approved Approved contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant