-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
firstDayOfWeek in DatePicker doesn't respect i18n #2073
Comments
Hi, @outofrange it will be great if you can create a pr for this issue. |
Temporary solution: import { CandyDate } from 'ng-zorro-antd'; |
Likely reference to https://github.com/date-fns/date-fns/blob/a5420d69a3f1e8f4533d02c09b6ce91cd1db78c6/src/locale/de/index.js#L26 as the default solution for all locales. |
1. get rid of DatePipe and Angular locales 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) docs(showcase): update all docs which related to date operations and Angular locales close NG-ZORRO#2819 NG-ZORRO#2406 NG-ZORRO#2293 NG-ZORRO#2073
1. get rid of DatePipe and Angular locales 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) refactor(schematics): replace angular locales with date-fns locales for project startup docs(showcase): update all docs which related to date operations and Angular locales close NG-ZORRO#2819 NG-ZORRO#2406 NG-ZORRO#2293 NG-ZORRO#2073 ddd
1. get rid of DatePipe and Angular locales 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) refactor(schematics): replace angular locales with date-fns locales for project startup docs(showcase): update all docs which related to date operations and Angular locales close NG-ZORRO#2819 NG-ZORRO#2406 NG-ZORRO#2293 NG-ZORRO#2073 ddd
…ule:i18n, schematics): replace angular locales with a better solution Following changes are made: 1. get rid of DatePipe and Angular locales 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. replace angular locales with date-fns locales for project startup 6. update all docs which related to date operations and Angular locales BREAKING CHANGE: removing angular locales introduce many changes below. 1. the format of DatePipe is not available, use [Date-fns format](https://date-fns.org/v1.30.1/docs/format#description) instead. 2. the firstDayOfWeek is 1 by default for nz-calendar and nz-date-picker. 3. "registerLocaleData" and "@angular/common/locales/*" are no longer used or imported by default. close NG-ZORRO#2819 NG-ZORRO#2406 NG-ZORRO#2293 NG-ZORRO#2073
…ule:i18n, schematics): replace angular locales with a better solution Following changes are made: 1. get rid of DatePipe and Angular locales 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. replace angular locales with date-fns locales for project startup 6. update all docs which related to date operations and Angular locales BREAKING CHANGE: removing angular locales introduce many changes below. 1. the format of DatePipe is not available, use [Date-fns format](https://date-fns.org/v1.30.1/docs/format#description) instead. 2. the firstDayOfWeek is 1 by default for nz-calendar and nz-date-picker. 3. "registerLocaleData" and "@angular/common/locales/*" are no longer used or imported by default. close NG-ZORRO#2819 NG-ZORRO#2406 NG-ZORRO#2293 NG-ZORRO#2073
…ule:i18n, schematics): replace angular locales with a better solution Following changes are made: 1. get rid of DatePipe and Angular locales 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. replace angular locales with date-fns locales for project startup 6. update all docs which related to date operations and Angular locales BREAKING CHANGE: removing angular locales introduce many changes below. 1. the format of DatePipe is not available, use [Date-fns format](https://date-fns.org/v1.30.1/docs/format#description) instead. 2. the firstDayOfWeek is 1 by default for nz-calendar and nz-date-picker. 3. "registerLocaleData" and "@angular/common/locales/*" are no longer used or imported by default. close NG-ZORRO#2819 NG-ZORRO#2406 NG-ZORRO#2293 NG-ZORRO#2073
…ule:i18n, schematics): replace angular locales with a better solution Following changes are made: 1. get rid of DatePipe and Angular locales 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. replace angular locales with date-fns locales for project startup 6. update all docs which related to date operations and Angular locales BREAKING CHANGE: removing angular locales introduce many changes below. 1. the format of DatePipe is not available, use [Date-fns format](https://date-fns.org/v1.30.1/docs/format#description) instead. 2. the firstDayOfWeek is 1 by default for nz-calendar and nz-date-picker. 3. "registerLocaleData" and "@angular/common/locales/*" are no longer used or imported by default. close NG-ZORRO#2819 NG-ZORRO#2406 NG-ZORRO#2293 NG-ZORRO#2073
…ule:i18n, schematics): replace angular locales with a better solution Following changes are made: 1. get rid of DatePipe and Angular locales 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. replace angular locales with date-fns locales for project startup 6. update all docs which related to date operations and Angular locales BREAKING CHANGE: removing angular locales introduce many changes below. 1. the format of DatePipe is not available, use [Date-fns format](https://date-fns.org/v1.30.1/docs/format#description) instead. 2. the firstDayOfWeek is 1 by default for nz-calendar and nz-date-picker. 3. "registerLocaleData" and "@angular/common/locales/*" are no longer used or imported by default. close NG-ZORRO#2819 NG-ZORRO#2406 NG-ZORRO#2293 NG-ZORRO#2073
…ule:i18n, schematics): replace angular locales with a better solution Following changes are made: 1. get rid of DatePipe and Angular locales 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. replace angular locales with date-fns locales for project startup 6. update all docs which related to date operations and Angular locales BREAKING CHANGE: removing angular locales introduce many changes below. 1. the format of DatePipe is not available, use [Date-fns format](https://date-fns.org/v1.30.1/docs/format#description) instead. 2. the firstDayOfWeek is 1 by default for nz-calendar and nz-date-picker. 3. "registerLocaleData" and "@angular/common/locales/*" are no longer used or imported by default. close NG-ZORRO#2819 NG-ZORRO#2406 NG-ZORRO#2293 NG-ZORRO#2073
…ule:i18n): support a new solution for date formatting Following changes are made: 1. both support date-fns and DatePipe for date formatting 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. update all docs which related to date operations and Angular locales close NG-ZORRO#2819, close NG-ZORRO#2406, close NG-ZORRO#2293, close NG-ZORRO#2073
…ule:i18n): support a new solution for date formatting Following changes are made: 1. both support date-fns and DatePipe for date formatting 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. update all docs which related to date operations and Angular locales close NG-ZORRO#2819, close NG-ZORRO#2406, close NG-ZORRO#2293, close NG-ZORRO#2073
…ule:i18n): support a new solution for date formatting Following changes are made: 1. both support date-fns and DatePipe for date formatting 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. update all docs which related to date operations and Angular locales close NG-ZORRO#2819, close NG-ZORRO#2406, close NG-ZORRO#2293, close NG-ZORRO#2073
…ule:i18n): support a new solution for date formatting Following changes are made: 1. both support date-fns and DatePipe for date formatting 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. update all docs which related to date operations and Angular locales close NG-ZORRO#2819, close NG-ZORRO#2406, close NG-ZORRO#2293, close NG-ZORRO#2073
…ule:i18n): support a new solution for date formatting Following changes are made: 1. both support date-fns and DatePipe for date formatting 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. update all docs which related to date operations and Angular locales close NG-ZORRO#2819, close NG-ZORRO#2406, close NG-ZORRO#2293, close NG-ZORRO#2073
…ule:i18n): support a new solution for date formatting Following changes are made: 1. both support date-fns and DatePipe for date formatting 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. update all docs which related to date operations and Angular locales close NG-ZORRO#2819, close NG-ZORRO#2406, close NG-ZORRO#2293, close NG-ZORRO#2073
…ule:i18n): support a new solution for date formatting Following changes are made: 1. both support date-fns and DatePipe for date formatting 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. update all docs which related to date operations and Angular locales close NG-ZORRO#2819, close NG-ZORRO#2406, close NG-ZORRO#2293, close NG-ZORRO#2073
…ule:i18n): support a new solution for date formatting Following changes are made: 1. both support date-fns and DatePipe for date formatting 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. update all docs which related to date operations and Angular locales close NG-ZORRO#2819, close NG-ZORRO#2406, close NG-ZORRO#2293, close NG-ZORRO#2073
…ule:i18n): support a new solution for date formatting Following changes are made: 1. both support date-fns and DatePipe for date formatting 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. update all docs which related to date operations and Angular locales close NG-ZORRO#2819, close NG-ZORRO#2406, close NG-ZORRO#2293, close NG-ZORRO#2073
…ule:i18n): support a new solution for date formatting (#2822) Following changes are made: 1. both support date-fns and DatePipe for date formatting 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. update all docs which related to date operations and Angular locales close #2819, close #2406, close #2293, close #2073
Hi i don't understand how set { To be set on app module?? or into component?? Thanks!! |
@Zacknero - inside app.module.ts, you add the following: @NgModule({
imports: [
...
],
declarations: [
...
],
providers: [
...,
{
provide: NZ_DATE_CONFIG,
useValue: {
firstDayOfWeek: 1, // week starts on Monday (Sunday is 0)
},
},
],
...
}) |
…ule:i18n): support a new solution for date formatting (NG-ZORRO#2822) Following changes are made: 1. both support date-fns and DatePipe for date formatting 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. update all docs which related to date operations and Angular locales close NG-ZORRO#2819, close NG-ZORRO#2406, close NG-ZORRO#2293, close NG-ZORRO#2073
Thanks so much @nclandrei !! This should be documented in Ng-Zorro docs |
…ule:i18n): support a new solution for date formatting (NG-ZORRO#2822) Following changes are made: 1. both support date-fns and DatePipe for date formatting 2. add DateHelperService to support date localization requirements 3. add NZ_DATE_LOCALE token to let user specify the date localization 4. add NZ_DATE_CONFIG token to customize date props(such as firstDayOfWeek) 5. update all docs which related to date operations and Angular locales close NG-ZORRO#2819, close NG-ZORRO#2406, close NG-ZORRO#2293, close NG-ZORRO#2073
Version
1.4.0
Environment
Windows 10, Chrome
Reproduction link
https://stackblitz.com/edit/ng-zorro-antd-start-3higab
Steps to reproduce
Open any date picker showing days
What is expected?
Since the locale (i.e. "de") has effect on nearly all elements in a date picker component, I would expect it to handle the start of the week correctly, which should be 'Monday' ('Montag')
What is actually happening?
The week is starting at Sunday
Other?
The problem is in the following line:
ng-zorro-antd/components/date-picker/lib/candy-date/util.ts
Line 7 in 69e1f5f
This should be refactored to handle more locales than 'zh-cn' and 'zh-tw'
The text was updated successfully, but these errors were encountered: