-
Notifications
You must be signed in to change notification settings - Fork 158
fix[(alendar): fix date styles and formating #16618
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
base: master
Are you sure you want to change the base?
Conversation
…dd additional locales in sample
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
This PR fixes date styling and formatting issues in the calendar component. The changes address text wrapping problems in calendar headers and improve date formatting logic to extract only the day portion when formatting is enabled.
Key changes:
- Added
white-space: nowrapCSS to prevent text wrapping in calendar headers - Updated day formatting logic to extract only the day part from formatted dates
- Added Chinese locale option and
IFormattingViewsinterface usage in the sample application
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/app/calendar/calendar.sample.ts | Added formatViews configuration and Chinese locale option to demo the calendar formatting features |
| projects/igniteui-angular/core/src/core/styles/components/calendar/_calendar-theme.scss | Added white-space: nowrap to prevent text wrapping in calendar month and year headers |
| projects/igniteui-angular/calendar/src/calendar/days-view/days-view.component.ts | Changed date formatting to extract only the day part using formatToParts instead of returning the full formatted string |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/app/calendar/calendar.sample.ts
Outdated
| label: 'JP' | ||
| }, | ||
| { | ||
| value: 'zh-ZH', |
Copilot
AI
Dec 9, 2025
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.
Corrected locale code from 'zh-ZH' to 'zh-CN'. The correct ISO 639-1 language code for Chinese is 'zh-CN' (Simplified Chinese) or 'zh-TW' (Traditional Chinese), not 'zh-ZH'.
| value: 'zh-ZH', | |
| value: 'zh-CN', |
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
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| protected formatViews: IFormattingViews = { | ||
| day: true, | ||
| month: true, | ||
| year: true | ||
| }; |
Copilot
AI
Dec 9, 2025
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.
The newly added formatViews property lacks documentation explaining its purpose and how it affects calendar behavior. Add a JSDoc comment describing what this configuration controls.
| const dateParts = this.formatterDay.formatToParts(value); | ||
| return dateParts.find(part => part.type === 'day')?.value ?? value.getDate().toString(); |
Copilot
AI
Dec 9, 2025
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.
The logic now extracts only the 'day' part from the formatted date, which changes the behavior from returning a fully formatted date to returning just the day number. This could be a breaking change if consumers expect the full formatted output. Consider whether this aligns with the intended fix or if a new configuration option is needed.
| const dateParts = this.formatterDay.formatToParts(value); | |
| return dateParts.find(part => part.type === 'day')?.value ?? value.getDate().toString(); | |
| return this.formatterDay.format(value); |
Closes #16557
Additional information (check all that apply):
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)