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

Use LOCALE_ID as default for locale settings #5393

Closed
csvn opened this issue Jun 28, 2017 · 2 comments · Fixed by #5419
Closed

Use LOCALE_ID as default for locale settings #5393

csvn opened this issue Jun 28, 2017 · 2 comments · Fixed by #5419
Assignees

Comments

@csvn
Copy link
Contributor

csvn commented Jun 28, 2017

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

Use LOCALE_ID from @angular/core as default for NativeDateAdapter and possible other locale related features.

What is the current behavior?

NativeDateAdapter uses the browsers locale.

What are the steps to reproduce?

Providing a Plunker (or similar) is the best way to get the team to see your issue.
http://plnkr.co/edit/I5RmX52yjb4U1v8n0fYT?p=preview

What is the use-case or motivation for changing an existing behavior?

Currently, it feels very clunky that you have to manually set the locale that is used by the datepicker by setting locale on DateAdapter. Especially if LOCALE_ID has already been specified. I expected an Angular library like Material to use the same locale setting as Angular (LOCALE_ID).

import { LOCALE_ID } from '@angular/core';
import { DateAdapter } from '@angular/material';

@NgModule({
  providers: [
    provide: LOCALE_ID,
    useValue: 'sv-SE'
  }
})
export class AppModule {
  constructor(dateAdapter: DateAdapter) {
    dateAdapter.setLocale('sv-SE');
  }
}

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular: 4.2+
Angular Material: 2.0.0-beta.7

Is there anything else we should know?

@csvn
Copy link
Contributor Author

csvn commented Jun 28, 2017

If you would appreciate a pull request for this, I could take a crack at it.

@crisbeto crisbeto self-assigned this Jun 29, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 29, 2017
Uses the `LOCALE_ID` from `@angular/core` to determine the default locale in the `NativeDateAdapter`.

BREAKING CHANGE: Until now, the `NativeDateAdapter` was using the browser locale, however the `LOCALE_ID` appears to default to `en-US`.

Fixes angular#5393.
mmalerba pushed a commit that referenced this issue Jul 7, 2017
Uses the `LOCALE_ID` from `@angular/core` to determine the default locale in the `NativeDateAdapter`.

BREAKING CHANGE: Until now, the `NativeDateAdapter` was using the browser locale, however the `LOCALE_ID` appears to default to `en-US`.

Fixes #5393.
mmalerba pushed a commit that referenced this issue Jul 9, 2017
Uses the `LOCALE_ID` from `@angular/core` to determine the default locale in the `NativeDateAdapter`.

BREAKING CHANGE: Until now, the `NativeDateAdapter` was using the browser locale, however the `LOCALE_ID` appears to default to `en-US`.

Fixes #5393.
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants