ngx bootstrap datepicker:我怎样才能改变工作日?

问题描述 投票:1回答:2

如何更改ngx bootstrap datepicker中的工作日?

来自:周一,周二,周三,周四,周五,周六,周日至:M,T,W,T,F,S,T

有人可以帮帮我吗?

datepicker example

datepicker ngx-bootstrap
2个回答
2
投票

谢谢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');
  }

}

1
投票

就我而言,我想使用西班牙语

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');   }

}
© www.soinside.com 2019 - 2024. All rights reserved.