如何解决“错误地显示星期几"的问题,在dx日历中? [英] How to fix "showing the days of week incorrectly" in dx-calendar?

查看:100
本文介绍了如何解决“错误地显示星期几"的问题,在dx日历中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到来自 devExtreme dx-calendar 组件的麻烦.我试图将一周的第一天设置为1,以将星期一设置为一周的第一天.组件的日期运行正常.但是问题出在字幕上.我正在使用Angular 7和devExtreme 18.

I have a trouble with a dx-calendar component from devExtreme. I tried to set the first day of week to 1 to set the Monday as the first day of the week. The dates of the components are working fine. But the problem is in the caption. I'm using Angular 7 and devExtreme 18.

在此引用此图片:( https://drive.google.com/open?id = 11g3igXM1lNfC03xsGeAN173uDlkXgBNH )

  <dx-calendar
    firstDayOfWeek="1"
    (onInitialized)="onInitialized()"
    (onValueChanged)="onValueChanged($event)"
    cellTemplate="custom"
  >
    <span
      *dxTemplate="let cell of 'custom'"
      [ngClass]="getCellCssClass(cell.date)">
      {{ cell.text }}
    </span>
  </dx-calendar>

...
  onInitialized() {
    const today = new Date();
    setTimeout(() => {
      $('.dx-calendar-caption-button span.dx-button-text').html(this.getFormatedDateString(today));
    }, 100);
  }
...
  getCellCssClass(date: string) {
    let cssClass = 'date ';
    const today = new Date();
    const d = new Date(date);
    const matchCase = this.specialDates.find((item) => {
      return item.date.toUTCString().substr(0, 16) === d.toUTCString().substr(0, 16);
    });
    if (matchCase === undefined) {
      if (today.toUTCString().substr(0, 16) === d.toUTCString().substr(0, 16)) {
        cssClass += 'today';
      }
    } else {
      cssClass += 'type' + matchCase.type;
    }
    return cssClass;
  }
...

推荐答案

我只是尝试使用dx-calendar,您的代码缺少选项"firstDayOfWeek"的[].

I just try using dx-calendar, your code is missing the [] for the option "firstDayOfWeek".

<dx-calendar [firstDayOfWeek]="1"></dx-calendar>

这篇关于如何解决“错误地显示星期几"的问题,在dx日历中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆