[major] Time input localization support#2501
Open
Jialecl wants to merge 7 commits into
Open
Conversation
Jialecl
marked this pull request as ready for review
July 14, 2026 11:23
PelayoFelgueroso
requested changes
Jul 22, 2026
|
|
||
| const languageContext = useContext(HalstackLanguageContext); | ||
| const translatedLabels = languageContext.labels; | ||
| const formatInfo = useMemo(() => getTimeInputLocale(languageContext.locale, timeFormat), [languageContext.locale]); |
Collaborator
There was a problem hiding this comment.
we need to put timeFormat inside the dependency array
| } | ||
| }; | ||
|
|
||
| const validateTimeValue = (value: string) => { |
Collaborator
There was a problem hiding this comment.
It always returns "Invalid time format"
Collaborator
Author
There was a problem hiding this comment.
Changed the validation expression and the regExp is built in utils based on the timeInput values.
| )} | ||
| <TimeInputField disabled={disabled} error={!!error} readOnly={readOnly}> | ||
| <DxcFlex gap="var(--spacing-gap-xs)" alignItems="center" fullHeight> | ||
| {formatInfo.format === "12" && formatInfo.dayPeriodPosition === "before" && ( |
Collaborator
There was a problem hiding this comment.
When day period is at the left, the user cannot move with the keyboard arrows
| const numberPart = | ||
| formatInfo.format === "12" ? time.split(" ")[formatInfo.dayPeriodPosition === "before" ? 1 : 0] : time; | ||
| if (numberPart) { | ||
| const [hourStr, minuteStr, secondStr] = numberPart.split(":"); |
Collaborator
There was a problem hiding this comment.
It should be numberPart.split(formatInfo.separator) instead of ":"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
(Check off all the items before submitting)
/libdirectory./websiteas needed.Purpose
Locale tag in HalstackProvider also supported by timeInput component