Skip to content

Support timeFormat in datetime field#179

Open
nhatrangnet wants to merge 1 commit intomasterfrom
fea/time-format
Open

Support timeFormat in datetime field#179
nhatrangnet wants to merge 1 commit intomasterfrom
fea/time-format

Conversation

@nhatrangnet
Copy link
Contributor

@nhatrangnet nhatrangnet requested a review from rilwis March 11, 2026 10:15
@rilwis rilwis closed this Mar 13, 2026
@rilwis rilwis reopened this Mar 13, 2026
@rilwis rilwis closed this Mar 13, 2026
@rilwis rilwis reopened this Mar 13, 2026
@opencode-agent
Copy link

Code Review Summary

Overview

This PR adds a new datetime_format control for datetime fields in the Meta Box Builder UI. The change adds 15 lines to Registry.php and makes a 1-line change in Fields.php.


Issues Found

1. Breaking Change - Incomplete Implementation
The PR replaces format with datetime_format in Fields.php:177, but:

  • The frontend component (assets/app/components/Editor/FieldTypePreview/Datetime.js:25) still uses field.format
  • The new setting won't actually work until the frontend is updated to use field.datetime_format

2. Confusing Label Duplication

  • Both format (line 136) and datetime_format (line 149) in Registry.php use the same label "Display format"
  • Users may not understand the difference between date-only and datetime formats

3. Backward Compatibility Concern

  • The old format control still exists in Registry but is no longer exposed to datetime fields
  • Existing meta boxes using datetime with custom format settings may behave unexpectedly

Recommendations

  1. Update frontend component: Modify Datetime.js to read field.datetime_format instead of field.format

  2. Consider keeping both: Either keep format available for datetime fields (for date-only display) or clarify the naming

  3. Improve label clarity: Rename the label to "Display format (date + time)" to distinguish from the date-only format


Security & Performance

  • No security concerns identified
  • No performance impact (only adds UI options)

New%20session%20-%202026-03-13T11%3A33%3A56.608Z
opencode session  |  github run

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.

2 participants