Last active
December 6, 2020 05:38
-
-
Save wohugb/6ee00c4f8ac757c301122d8957561aca to your computer and use it in GitHub Desktop.
mat-datepicker locale localization 中文 本地化 angular material
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from '@angular/core'; | |
import { CommonModule } from '@angular/common'; | |
import { MatNativeDateModule, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core'; | |
import { MatDatepickerIntl, MatDatepickerModule } from '@angular/material/datepicker'; | |
@NgModule({ | |
declarations: [TradingComponent, OrderListComponent, EarningListComponent], | |
imports: [ | |
... | |
MatDatepickerModule, | |
], | |
providers: [ | |
..., | |
{ provide: MAT_DATE_LOCALE, useValue: 'zh-cn' }, // 为啥用的是moment里的呢 而不是angular 得zh-Hans呢 | |
], | |
}) | |
export class AppModule {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这里用的是moment的zh-cn而不是angular里的zh-Hans