You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Datepicker: Year selection mode doesn't work with years before 1986 #9534
Select year before 1986 correctly through "year selection mode", implemented in #8565
What is the current behavior?
The year 1985 is missing, so when you select any year before 1986, it selects a year later, for example, when you select 1981, datepicker selects 1982.
Hi there in any case that it might be usefull, some of the device were having the same kind of weird issue.
We fixed it by fixing the locale in the constructor in english, following the french exemple in the doc as per 👍
providers: [
// The locale would typically be provided on the root module of your application. We do it at
// the component level here, due to limitations of our example generation script.
{provide: MAT_DATE_LOCALE, useValue: 'en-US'},
// `MomentDateAdapter` and `MAT_MOMENT_DATE_FORMATS` can be automatically provided by importing
// `MatMomentDateModule` in your applications root module. We provide it at the component level
// here, due to limitations of our example generation script.
{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
{provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS},
]
Hi @anymos The datepicker working as expected after adding your example from above but, I think this is not a correct way or maybe not. I don't know 😆 but Thanks anyway! 👍
That workaround works because the bug is caused by the way DST is handled, and different locales have different DST rules. The real fix is to convert the dates to UTC for consistency before formatting. (coming in #10068)
Activity
anymos commentedon Feb 24, 2018
Hi there in any case that it might be usefull, some of the device were having the same kind of weird issue.
We fixed it by fixing the locale in the constructor in english, following the french exemple in the doc as per 👍
providers: [
// The locale would typically be provided on the root module of your application. We do it at
// the component level here, due to limitations of our example generation script.
{provide: MAT_DATE_LOCALE, useValue: 'en-US'},
this.adapter.setLocale('en');
irowbin commentedon Feb 24, 2018
Hi @anymos The
datepickerworking as expected after adding your example from above but, I think this is not a correct way or maybe not. I don't know 😆 but Thanks anyway! 👍mmalerba commentedon Feb 24, 2018
That workaround works because the bug is caused by the way DST is handled, and different locales have different DST rules. The real fix is to convert the dates to UTC for consistency before formatting. (coming in #10068)
angular-automatic-lock-bot commentedon Sep 8, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.