feat(profile): custom date/time format builder with token preview #119

Merged
YousifShkara merged 1 commit from feat/pms-254-custom-date-format-builder into main 2026-06-12 09:01:02 +02:00
Owner

Lands the second slice of PMS-252: the Custom... button under the preset dropdown now opens a modal with the Date Builder shown in the design. Users can either type into the free-form Format string input or click any of the labelled token pills (Year YYYY/YY, Month MM/M/MMM/MMMM, Day DD/D/Do, Weekday ddd/dddd, Hour HH/H/hh/h, Minute mm/m, Second ss/s, AM/PM A/a/a.m., Separators -/./,/space/colon). Pill clicks append the token to the draft. A live preview at the top of the modal renders against now() so every edit is visible immediately; a yellow alert lights up whenever the format contains an alphabetic run the tokenizer cannot consume, e.g. a typo'd lowercase yyyy.

Cancel keeps the previously-saved format intact; Apply writes the draft back into the parent signal and is disabled while warnings are present so a broken format cannot leave the modal. Save changes on the Profile page still drives the same /me PUT round-trip the preset slice uses, so the persistence path is unchanged.

crate::utils::datetime::token_warnings ships with 7 unit tests covering empty input, fully-valid formats, lowercase/uppercase typos, stray letters between tokens, runs that contain both valid and invalid bytes, and adjacent-token cases that must not false-warn.

#PMS-254

Lands the second slice of PMS-252: the Custom... button under the preset dropdown now opens a modal with the Date Builder shown in the design. Users can either type into the free-form Format string input or click any of the labelled token pills (Year YYYY/YY, Month MM/M/MMM/MMMM, Day DD/D/Do, Weekday ddd/dddd, Hour HH/H/hh/h, Minute mm/m, Second ss/s, AM/PM A/a/a.m., Separators -/./,/space/colon). Pill clicks append the token to the draft. A live preview at the top of the modal renders against now() so every edit is visible immediately; a yellow alert lights up whenever the format contains an alphabetic run the tokenizer cannot consume, e.g. a typo'd lowercase yyyy. Cancel keeps the previously-saved format intact; Apply writes the draft back into the parent signal and is disabled while warnings are present so a broken format cannot leave the modal. Save changes on the Profile page still drives the same /me PUT round-trip the preset slice uses, so the persistence path is unchanged. `crate::utils::datetime::token_warnings` ships with 7 unit tests covering empty input, fully-valid formats, lowercase/uppercase typos, stray letters between tokens, runs that contain both valid and invalid bytes, and adjacent-token cases that must not false-warn. #PMS-254
feat(profile): custom date/time format builder with token preview
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Successful in 2m39s
f4fe14e230
Lands the second slice of PMS-252: the Custom... button under the preset dropdown now opens a modal with the Date Builder shown in the design. Users can either type into the free-form Format string input or click any of the labelled token pills (Year YYYY/YY, Month MM/M/MMM/MMMM, Day DD/D/Do, Weekday ddd/dddd, Hour HH/H/hh/h, Minute mm/m, Second ss/s, AM/PM A/a/a.m., Separators -/./,/space/colon). Pill clicks append the token to the draft. A live preview at the top of the modal renders against now() so every edit is visible immediately; a yellow alert lights up whenever the format contains an alphabetic run the tokenizer cannot consume, e.g. a typo'd lowercase yyyy.

Cancel keeps the previously-saved format intact; Apply writes the draft back into the parent signal and is disabled while warnings are present so a broken format cannot leave the modal. Save changes on the Profile page still drives the same /me PUT round-trip the preset slice uses, so the persistence path is unchanged.

`crate::utils::datetime::token_warnings` ships with 7 unit tests covering empty input, fully-valid formats, lowercase/uppercase typos, stray letters between tokens, runs that contain both valid and invalid bytes, and adjacent-token cases that must not false-warn.

#PMS-254
YousifShkara deleted branch feat/pms-254-custom-date-format-builder 2026-06-12 09:01:02 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
psa-systems/mokosh-apps!119
No description provided.