一年中的一周与一年中的一周中的ISO令牌(moment.js)之间的差异 [英] Difference between week of year and week of year ISO tokens (moment.js)

查看:128
本文介绍了一年中的一周与一年中的一周中的ISO令牌(moment.js)之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究moment.js中的日期格式,并且遇到了以下这些标记: WoYWoY ISO之间有什么显着区别吗?

I was studying date formating in moment.js and I came across these tokens: Is there any significant difference between WoY and WoY ISO?

一年中的一周

w - 1 2 ... 52 53  
wo - 1st 2nd ... 52nd 53rd  
ww - 01 02 ... 52 53

年度最佳(ISO)

W - 1 2 ... 52 53  
Wo - 1st 2nd ... 52nd 53rd  
WW - 01 02 ... 52 53

推荐答案

根据 Wikipedia , ISO周计数器从一年的第一个星期四开始;因此,如果一年的第一天是星期六,那么第一个星期四将在下周.

According to Wikipedia, the ISO week counter starts the first thursday of the year; so, if the first day of the year is saturday, the first thursday will be in the next week.

因此,第一个星期四的ISO周将是第一个星期,但是第一个星期四的标准周将是第二个星期,例如

Thus, the ISO week of the first thursday will be the first, but the standard week of the first thursday will be the second, e.g.

moment('2005-01-02').isoWeek(); // 53
moment('2005-01-02').week(); // 1
moment('2005-01-03').isoWeek(); // 1
moment('2005-01-03').week(); // 2

致谢!

这篇关于一年中的一周与一年中的一周中的ISO令牌(moment.js)之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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