Fix: time format issue in datepicker mask#16922
Conversation
LogDetails |
packages/twenty-front/src/modules/localization/hooks/useDateTimeFormat.ts
Show resolved
Hide resolved
packages/twenty-front/src/modules/localization/utils/resolveTimeFormat.ts
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/input/components/internal/date/utils/getDateTimeMask.ts
Outdated
Show resolved
Hide resolved
|
@vasu1303 Thanks for opening this PR—much appreciated. We only accept PRs with passing (green) tests. Since the overall direction looks good, I’ve added a few comments to help guide you. I’m going to close this PR for now because the tests are failing, but feel free to reopen it if you have the bandwidth to continue working on it. We’ll be happy to keep reviewing it. To reopen the PR, you can comment: |
|
/twenty pr open |
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:55480 This environment will automatically shut down when the PR is closed or after 5 hours. |
|
Hi @charlesBochet, sorry for the delay in getting back to this! I have now addressed all the feedback: I unified the date and time resolution using utilities and refactored the components to pass { dateFormat, timeFormat } as an object to improve the DevXP. I've also made sure the tests are passing. Let me know if this looks good! |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
@vasu1303 Nice work. After testing this, there's a small UX problem. The The input has been developed to not destroy any other part when modifying only a part of the date time input text. You can find the right lifecycle with the mask and the input to avoid this annoying effect. |
Enregistrement.de.l.ecran.2026-01-21.a.10.58.06.mov |
- Adds resolveDateFormat for consistency - Passes props as objects
f697442 to
18e42ee
Compare
.../modules/ui/input/components/internal/date/hooks/useParseJSDateToIMaskDateTimeInputString.ts
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/input/components/internal/date/utils/getTimeBlocks.ts
Show resolved
Hide resolved
|
Hi @vasu1303 nice work. I've decided to preserve the input instead of forcing the enum, since the final validation is still here, it's less painful to be able to enter a wrong first character than to lose the AM/PM part every time we change another block. |
packages/twenty-front/src/modules/ui/input/components/internal/date/utils/getTimeBlocks.ts
Show resolved
Hide resolved
|
Hey @lucasbordeau! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
1 similar comment
|
Hey @lucasbordeau! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
|
Hi @lucasbordeau, thank you for the appreciation and you taking the time out to fix that UX issue. Sorry I couldn't circle back sooner due to a busy streak on my end, but I'm glad to see it merged. Thanks! |
Fixes: #16872
Summary
Fixes the DateTimePicker to respect user's 12H/24H time format preference. Previously, the time display at the top of the DateTimePicker always showed 24-hour format (e.g., "14:30") regardless of the user's time format setting.
Screenshots
After: Time respects user preference, showing 12H with AM/PM (e.g., "03:28 PM") or 24H format

Implementation Details
Changes Made:
getTimeMask()to return appropriate mask pattern based on time formattimeFormatparametergetTimePattern()helper (returns 'hh:mm a' for 12H, 'HH:mm' for 24H)timeFormatparameter for consistencyTechnical Approach:
useDateTimeFormat()hook to get user'stimeFormatpreferenceTimeFormat.SYSTEM,TimeFormat.HOUR_12, andTimeFormat.HOUR_24