nebular
nebular copied to clipboard
NbDatepicker and NbRangepicker doesn't work properly with 'es' locale
Issue type
I'm submitting a ... (check one with "x")
- [x] bug report
- [ ] feature request
Issue description
Current behavior:
NbDatepicker and NbRangepicker doesn't work properly with es locale. Once the Angular LOCALE_ID has been set the component doesn't render some selected dates, specifically the April ones. If I remove the LOCALE_ID from the AppModule providers it works well.
Expected behavior: The component must work correctly with 'es' locale.
Steps to reproduce:
Set up the LOCALE_ID with es locale and select a date in April.
It's happening something similar with es-CO locale.
Related code: I built a small project with the minimum needed to reproduce the Bug: nb-datepicker-es-locale-issue
Other information:
npm, node, OS, Browser
Node, npm: `node --version` and `npm --version` 7.14.0
OS: Windows Linux (Ubuntu 18)
Browser: Chrome/
Angular, Nebular
Angular: 11.2.1
Nebular: 7.0.0
Thanks for the help!
Seems similar case #1225
For now if it is possible I suggest to use moment or date-fns.
Please see Formatting issues https://akveo.github.io/nebular/docs/components/datepicker/overview#nbdatepickerdirective
@andreipadolin Could you explain how to use NbMomentDateService? I import NbMomentDateModule and provide NbMomentDateService. But I don't know how to use it to change locale, the doc on website is not enough clear for me. Thanks!
@andreipadolin I think maybe I misunderstanding. The service cannot set display language now, right? I want to change display language on nb-datepicker
@andreipadolin I got it, just use angular's i18n feature.
import { registerLocaleData } from '@angular/common';
import zh_Hant from '@angular/common/locales/zh-Hant';
registerLocaleData(zh_Hant, 'zh-tw'');
@NgModule({
...
providers: [
{ provide: LOCALE_ID, useValue: 'zh-tw' },
],
...
});
I'm having the same issue with the NbRangepicker using 'es', works fine in 'en'. Did someone find a solution for this yet? thank you! :)
Edit: It has to be something associated with the name of the month, because in some months it works, such as February, whose first 3 acronyms coincide with their corresponding translation February (feb = feb). This is not the case of January, for example, whose 3 initials do not match (ENE != JAN).