如何在自定义日历中从星期一开始几周
How can I start weeks from Monday in Custom Calendar
我必须让这个日历从星期一开始几周,我使用了 Codepen 中的一些代码,但我无法更改此选项。
这是 codepen 的 link: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();
}
最简单的方法是在代码末尾添加:
moment.updateLocale("en", { week: {
dow: 1 // First day of week is Monday
}});
这是一个update Fiddle
遵循 moment.js 准则:HERE
我必须让这个日历从星期一开始几周,我使用了 Codepen 中的一些代码,但我无法更改此选项。 这是 codepen 的 link: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();
}
最简单的方法是在代码末尾添加:
moment.updateLocale("en", { week: {
dow: 1 // First day of week is Monday
}});
这是一个update Fiddle
遵循 moment.js 准则:HERE