-
-
Notifications
You must be signed in to change notification settings - Fork 362
fix(TimePicker): Use culture-invariant formatting for CSS transform values #6790
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
fix(TimePicker): Use culture-invariant formatting for CSS transform values #6790
Conversation
|
Thanks for your PR, @Copilot. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Co-authored-by: ArgoZhang <[email protected]>
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.
Pull Request Overview
Fixes CSS transform formatting issue in TimePickerCell for cultures using comma as decimal separator. The problem caused invalid CSS generation in Turkish, German, and French locales where decimal values were formatted with commas instead of dots required by CSS standards.
- Fixed CSS transform value formatting to use culture-invariant formatting (dots instead of commas)
- Added comprehensive test to verify the fix works across different cultures
- Ensured backward compatibility with no breaking changes
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/BootstrapBlazor/Components/TimePicker/TimePickerCell.razor.cs | Modified StyleName property to use CultureInfo.InvariantCulture for CSS transform formatting |
| test/UnitTest/Components/TimePickerTest.cs | Added test case to verify culture-invariant CSS formatting in Turkish locale |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6790 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 739 739
Lines 31721 31721
Branches 4464 4464
=========================================
Hits 31721 31721
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Problem
In cultures that use comma as decimal separator (e.g., Turkish
tr-TR, Germande-DE, Frenchfr-FR), theTimePickerCellcomponent generates invalid CSS for the scroll transform animation. The issue occurs because theCalcTranslateY()method returns adoublevalue that gets formatted using the current culture's decimal separator when interpolated into the CSS string.This results in invalid CSS like:
Instead of the expected valid CSS:
Solution
Modified the
StyleNameproperty inTimePickerCell.razor.csto explicitly useCultureInfo.InvariantCulturewhen formatting the decimal value for CSS output:This ensures CSS values always use dots as decimal separators regardless of the user's culture settings.
Testing
TimePickerCell_StyleName_CultureInvariant()that reproduces the issue by setting Turkish culture and validates the fixImpact
Fixes the TimePickerCell scroll animation issues reported by users in Turkish and other comma-decimal cultures.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.