-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Defaults for days of week too short - should be 3 letters, Mon, Tue, #2516
Comments
Hey, @httpete !
Well, that's not a valid argument, I say it should be Mo, Tu, We :) An option would be to change existing: @Input() showWeekdays: boolean; to // 1. change existing input
@Input() showWeekdays: boolean | TranslationWidth;
// 2. introduce a new one and remove existing `showWeekdays`
@Input() weekdays: boolean | TranslationWidth;
// 3. introduce a new one without removing the existing
@Input() weekdayFormat: TranslationWidth;
// 4. introduce it via the injection token
{ provide: NGB_DATEPICKER_WEEKDAY_FORMAT, useValue: TranslationWidth.XXX } I prefer |
Hi Max, yes I was being a little terse but it should be configurable without having to override the provider (although I am learning alot about Angular DI in the process!). Are you saying that ngbDatePickerConfig can do this in one place for our whole app? |
Hi all ! If we want to align to Intl.DateTimeFormat, then @httpete is right For Do we want to align with this API ? I don't know. |
@benouat, interesting. We already use Angular internally, and align with what Angular comes with: export declare enum TranslationWidth {
Narrow = 0,
Abbreviated = 1,
Wide = 2,
Short = 3,
} It's just we default to |
it would be such an easy fix to align to the standard, but even better if it were configurable. |
Closing as we won't introduce a new feature for that, especially that could be worked around by as @maxokorokov suggested by providing this in any component where the datepicker would be used. // 4. introduce it via the injection token
{ provide: NGB_DATEPICKER_WEEKDAY_FORMAT, useValue: TranslationWidth.Abbreviated }
|
I am having trouble implementing this recommendation
Does this apply to the latest version? I cannot find where to import NGB_DATEPICKER_WEEKDAY_FORMAT from. |
There was a misunderstanding, I guess. There is no workaround at the moment, so I'll reopen this feature request. |
- introduces new `@Input() weekday: boolean | TranslationWidth` in `NgbDatepicker` and `NgbInputDatepicker` - introduces new `getWeekdayLabel(date, width)` in `NgbDatepickerI18n` Fixes ng-bootstrap#2516
- introduces new `@Input() weekday: boolean | TranslationWidth` in `NgbDatepicker` and `NgbInputDatepicker` - introduces new `getWeekdayLabel(date, width)` in `NgbDatepickerI18n` Fixes ng-bootstrap#2516
- introduces new `@Input() weekday: boolean | TranslationWidth` in `NgbDatepicker` and `NgbInputDatepicker` - introduces new `getWeekdayLabel(date, width)` in `NgbDatepickerI18n` Fixes ng-bootstrap#2516
- introduces new `@Input() weekday: boolean | TranslationWidth` in `NgbDatepicker` and `NgbInputDatepicker` - introduces new `getWeekdayLabel(date, width)` in `NgbDatepickerI18n` Fixes #2516
Please remember, the issues forum is NOT for support requests. It is for bugs and feature requests only.
Please read https://github.com/ng-bootstrap/ng-bootstrap/blob/master/CONTRIBUTING.md and search
existing issues (both open and closed) prior to opening any new issue and ensure you follow the instructions therein.
Bug description:
By default, the i18n choice for the days of the month from the datepicker is: Mo, Tu, We
It should be Mon, Tue, Wed etc like the old one:
https://angular-ui.github.io/bootstrap/ (search for datepicker)
IT would be an easy fix on your end, the enum Const that stores the i18n length just needs to be Abbreviation not Short.
Overridding it is hard, https://stackoverflow.com/questions/50900233/internationalization-of-datepickers
You can see that in order to change it we have to override that provider with our own.
Link to minimally-working plunker that reproduces the issue:
You can fork a plunker from one of our demos and use it as a starting point.
Please note that we can not act on bug reports without a minimal reproduction scenario in plunker. Here is why:
https://github.com/ng-bootstrap/ng-bootstrap#you-think-youve-found-a-bug
Version of Angular, ng-bootstrap, and Bootstrap:
Angular: All
ng-bootstrap: latest
Bootstrap: no matter
The text was updated successfully, but these errors were encountered: