Skip to content

Instantly share code, notes, and snippets.

@wohugb
Last active December 6, 2020 05:38
Show Gist options
  • Save wohugb/6ee00c4f8ac757c301122d8957561aca to your computer and use it in GitHub Desktop.
Save wohugb/6ee00c4f8ac757c301122d8957561aca to your computer and use it in GitHub Desktop.
mat-datepicker locale localization 中文 本地化 angular material
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 {}
@wohugb
Copy link
Author

wohugb commented Dec 6, 2020

这里用的是moment的zh-cn而不是angular里的zh-Hans

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment