0

I want the date-format "YYYY/MM/DD" and therefore I use 'ja-JP' in my app.module

providers: [
    {provide: MAT_DATE_LOCALE, useValue: 'ja-JP'},
]

I get the right date-format "YYYY/MM/DD" but the datepicker is displayed in japanese.

enter image description here

I would like to keep the default layout

enter image description here

Can you help me?

user16405471
  • 61
  • 1
  • 7

1 Answers1

1

Use following way to convert date as yyyy-mm-dd . this will work .

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

import { MomentDateAdapter, } from '@angular/material-moment-adapter';

@NgModule( {

providers: [
{ provide: DateAdapter, useClass: MomentDateAdapter },

{ provide: MAT_DATE_FORMATS, useValue: DATE_FORMATS },
]

})

export class SharedModule { }

Install @angular/material-moment-adapter using npm i @angular/material-moment-adapter

toyota Supra
  • 3,181
  • 4
  • 15
  • 19