Skip to content
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(calendar): make weekStart default value to depend on current locale #11458

Closed
wants to merge 21 commits into from

Conversation

Volen99
Copy link
Contributor

@Volen99 Volen99 commented Apr 21, 2022

Closes #10543, #10852

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them

@Volen99 Volen99 requested a review from hanastasov April 21, 2022 13:06
@Volen99 Volen99 added 🧰 feature-request ❌ status: awaiting-test PRs awaiting manual verification labels Apr 21, 2022
@hanastasov hanastasov added 💥 status: in-test PRs currently being tested and removed ❌ status: awaiting-test PRs awaiting manual verification labels May 18, 2022
Copy link
Contributor

@hanastasov hanastasov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bugs found:

  1. Let's set a global LOCALE_ID for calendar.sample.html:
@Component({
    selector: 'app-calendar-sample',
    templateUrl: 'calendar.sample.html',
    styleUrls: ['calendar.sample.scss'],
    providers: [{provide: LOCALE_ID, useValue: 'fr-FR' }]
})
Result:
Calendar is not displayed per FR locale. This is Story 1 from the spec.
  1. When passing invalid value for locale, then setting weekStart is not respected:
<igx-date-picker **locale='US'** [weekStart]="5" 

Result: weekStart is not Friday. Check if same is for grid, date-range picker, etc.

@@ -258,6 +259,9 @@ export class IgxCalendarBaseDirective implements ControlValueAccessor {
*/
public set locale(value: string) {
this._locale = value;
if (!this.weekStart) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have set weekStart to be WEEKDAYS.Sunday (equals 0), this check will always evaluate as true and override the value. Example:

<igx-date-picker locale="FR" [weekStart]="0" 

weekStart will always be 1, which is the default of french locale.

@Volen99 Volen99 closed this May 30, 2022
@Volen99 Volen99 deleted the VDyulgerov/feature-startWeek-locale branch May 30, 2022 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IgxCalendar: set weekStart globally
2 participants