【问题标题】:How can I start weeks from Monday in Custom Calendar如何在自定义日历中从星期一开始几周
【发布时间】:2020-01-20 18:42:13
【问题描述】:

我必须让这个日历从星期一开始几周,我使用了 Codepen 的一些代码,但我无法更改此选项。 这是codepen的链接:https://codepen.io/jtrumbull/pen/obPMWg

var Calendar = function (elem, options) {
    this.elem = elem;
    this.options = $.extend({}, Calendar.DEFAULTS, options);
    this.init();
  };

  Calendar.DEFAULTS = {
    datetime: undefined,
    dayFormat: 'DDD',
    weekFormat: 'DDD',
    monthFormat: 'MM/DD/YYYY',
    weekStart: '1',
    view: undefined,
  };
  Calendar.prototype.init = function () {
    if (! this.options.datetime || this.options.datetime == 'now') {
      this.options.datetime = moment();
    }
    if (! this.options.view) {
      this.options.view = 'month';
    }
    this.initScaffold()
        .initStyle()
        .render();
  }

【问题讨论】:

    标签: jquery calendar


    【解决方案1】:

    最简单的方法是在代码末尾添加:

    moment.updateLocale("en", { week: {
      dow: 1 // First day of week is Monday
    
    }});
    

    这是update Fiddle

    以下是 moment.js 指南:HERE

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-22
      • 1970-01-01
      • 2020-03-24
      • 1970-01-01
      • 2020-07-02
      • 2011-06-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多