设置每周的第一天。日历。 JS [英] Setting up the fist day of the week. Calendar. JS

查看:556
本文介绍了设置每周的第一天。日历。 JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了此脚本使用JavaScript创建日历。我重写得足够多了,例如,我建立了对上一个和下个月的日子的查看,对上一个或下个月的日子的查看,等等。但是基本算法仍然与该文章中所写的相同(对于循环 //填写天。

I used this script to create a calendar with JavaScript. I rewrote it enough, for instance, I built viewing of the previous and next month's days, viewing previous or next month, etc. But the basic algorithm remains the same as it was written in that article (for loops "// fill in the days").

现在,当一切正常时,我需要将一周的第一天设为星期一,而不是星期日。不幸的是,我无法想象如何更改循环才能使此功能正常工作。

Well now, when everything works pretty good, I need the first day of the week to be Monday, not Sunday. Unfortunately, I can't imagine how to change the loops in order this feature to work.

因此,我需要如何更改循环以使星期一成为第一天一周中的?谢谢。

So, how do I need to change the loops to make Monday the first day of the week? Thanks.

推荐答案

这是从星期一开始的每周工作代码: http://jsfiddle.net/VL44m/

Here is a working code for week starting from Monday: http://jsfiddle.net/VL44m/

进行了两项更改:

来自 cal_days_labels = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];

cal_days_labels = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'] ;

发件人

// this loop is for weekdays (cells)
    for (var j = 0; j <= 6; j++) { 

// this loop is for weekdays (cells)
    for (var j = 1; j <= 7; j++) {

这篇关于设置每周的第一天。日历。 JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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