-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(input-time-picker): add hour-format property #10059
Conversation
…lharper/4756-time-picker-24-hour-support
… value of 0:0:0 resulted in a clearing of the value
… where we need to set the localized input value. Also fixed a place where localized meridiem wasn't being set properly.
…we can determine hourcycle from just the locale. Refactored input-time-picker to match time-picker in how it updates locale state when it changes, including setting a default hourCycle when one is not provided.
…rd to something better
… on hourCycle. Not perfectly working, but we'll need this to get to the next step which is to parse both 12 and 24 hour formats. Fixing Arabic locale time format overrides to match ICU.
…e working regardless of hourCycle!
…ater in the e2e typing tests
…alue to nil. Also adding comprehensive locale typing tests, need to expand a bit more and fix a few locales still
…ult locales by correcting the regex to capture whitespace characters on either side of the meridiem tokens in the time format string
…l supported locales to test that render meridiem to the left of the time value
…t seem to like a lot of the localized meridiem formats, so we may want to ship this with the caveat that it might not work just right for all locales
…s and mk decimal separators in Chromium
…renaming some variables in 12-hour test to make them more meaningful
…lharper/4756-time-picker-24-hour-support
… element. Attempt to see if this resolves random unstable test failures
This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions. |
This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions. |
This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I thought I had submitted this feedback previously. I believe you've addressed it already, but wanted to submit just in case.
packages/calcite-components/src/components/input-time-picker/input-time-picker.tsx
Show resolved
Hide resolved
localizedTwentyFourHourMeridiems.has(this.effectiveLocale) && | ||
effectiveHourFormat === "12" | ||
) { | ||
const localizedAM = localizedTwentyFourHourMeridiems.get(this.effectiveLocale).am; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. Based on how often localizing logic takes place, we should look into refactoring to improve performance (e.g., reusing/minimizing objects across internal localization updates). It would benefit both localizing and delocalizing paths. We can do this in a follow-up refactor issue if local perf testing looks good.
@eriklharper Per #10997 (comment), I'm converting this to a draft to avoid reviewer confusion. |
Closing in favor of #10997 |
Related Issue: #4756
Summary
This PR exposes a new
hour-format
property toinput-time-picker
andtime-picker
that overrides the locale's defaulthourCycle
setting, allowing a 12-hour locale to be formatted in 24-hour time and vice versa. Confirmed with the i18n team that the bulgarianч.
character (abbreviation for "hours") should not display for short and medium time formats.