-1

I'm using Nebular ngx-admin. How do I customize your new datepicker component? How can I change the local settings and display the component as a Turkish calendar. I've reviewed the library, but I think it's about it. Is there any other way I can do this.

3 Answers3

0

All you need to do is change Angular locale to Turkish. This article might be helpful to you: https://angular.io/guide/i18n

Shorty, define appropriate provider in your AppModule:

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

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

@NgModule({
    imports: [ BrowserModule ],
    declarations: [ AppComponent ],
    providers: [ { provide: LOCALE_ID, useValue: 'tr' } ],
    bootstrap: [ AppComponent ]
})
export class AppModule { }
Vladimir Lugovsky
  • 197
  • 1
  • 4
  • 12
0
import es from '@angular/common/locales/es';
import { registerLocaleData } from '@angular/common';
registerLocaleData(es);
@NgModule({
  providers: [
    { provide: LOCALE_ID, useValue: "es-ES" }, //your locale
  ]
})
  • 1
    You need to provide an explanation as to how your code would solve the problem and also explain your code, at least in a few words. – Dima Kozhevin Dec 27 '18 at 06:21
0

Add this line on app.module.ts file.

import { defineLocale } from 'ngx-bootstrap/chronos';
import { trLocale } from 'ngx-bootstrap/locale';
defineLocale('tr', trLocale);

And on your component.ts

import { BsLocaleService } from 'ngx-bootstrap/datepicker';
constructor(private localService: BsLocaleService){
  this.localService.use("tr");
}