简体   繁体   English

时刻 js 给出不正确的一周

[英]Moment js giving incorrect week

Here's my javascript这是我的 javascript

dt = moment("2016-01-01");
console.log(dt.week());

This gives week as 1这使周为 1

but when I refer to bootstrap calendar then it shows week as 53 of last year但是当我提到引导日历时,它会显示去年的第 53 周

在此处输入图片说明

can someone tell which is correct moment or bootstrap calendar?有人能说出哪个是正确的时刻或引导日历吗? Also why?还有为什么?

PS - datepicker I am using is ui.bootstrap.datepicker from https://angular-ui.github.io/bootstrap/ PS - 我使用的日期选择器是来自https://angular-ui.github.io/bootstrap/ 的ui.bootstrap.datepicker

经过一番谷歌搜索,我发现在我的情况下使用isoWeek()给出了正确的周数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM