0
       <span>{{
            value | date: 'E, dd/MM/yyyy':undefined:languageCode
        }}</span>

I have a scenario in which I need to pass the locale code corresponding to Cambodia's KHMER language. I tried multiple locale codes but they didn't work as expected. Could anyone please help me in finding the locale code for the KHMER language of Cambodia?

The above code is working fine for Chinese, English...

Sweta Jain
  • 3,248
  • 6
  • 30
  • 50

1 Answers1

1

You just to register locale data with km provides on @angular/common/locales

example

On your app.module.ts

import { LOCALE_ID, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';

import { registerLocaleData } from '@angular/common';
import km from '@angular/common/locales/km';

registerLocaleData(km);

import { AppComponent } from './app.component';

@NgModule({
  imports: [BrowserModule, FormsModule],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
  providers: [{ provide: LOCALE_ID, useValue: 'km_KH' }],
})
export class AppModule {}
Guiditox
  • 657
  • 4
  • 10