如何更改ngx bootstrap datepicker中的工作日?
来自:周一,周二,周三,周四,周五,周六,周日至:M,T,W,T,F,S,T
有人可以帮帮我吗?
谢谢Himanshu,
我能够解决这个问题:
import { Component, OnInit } from '@angular/core';
import { setTheme } from 'ngx-bootstrap/utils';
import { BsLocaleService } from 'ngx-bootstrap/datepicker';
import { defineLocale } from 'ngx-bootstrap/chronos';
import { enGbLocale } from 'ngx-bootstrap/locale';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
title = 'app';
constructor(private localeService: BsLocaleService) {
setTheme('bs4');
enGbLocale.weekdaysShort = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
enGbLocale.week.dow = 0;
defineLocale('en', enGbLocale);
}
ngOnInit() {
this.localeService.use('en');
}
}
就我而言,我想使用西班牙语
import { Component, OnInit } from '@angular/core';
import { setTheme } from 'ngx-bootstrap/utils';
import { BsLocaleService } from 'ngx-bootstrap/datepicker';
import { defineLocale } from 'ngx-bootstrap/chronos';
import { esDoLocale } from 'ngx-bootstrap/locale';
@Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent implements OnInit { title = 'app';
constructor(private localeService: BsLocaleService) {
esDoLocale.weekdaysShort = ['L', 'M', 'M', 'J', 'V', 'S', 'D'];
esDoLocale.week.dow = 0;
defineLocale('es', esDoLocale); }
ngOnInit() {
this.localeService.use('es'); }
}