Difference between week of year and week of year ISO tokens (moment.js)

后端 未结 1 1783
一整个雨季
一整个雨季 2020-12-21 00:43

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

Wee

相关标签:
1条回答
  • 2020-12-21 01:18

    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.

    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
    

    Regards!

    0 讨论(0)
提交回复
热议问题