captbaritone / captbaritone/datejs
setWeek produces incorrect results on the last week of the year
Open
auto-migrated
Priority-Medium
Type-Defect
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
```
Date.today().toString()
"Wed Dec 28 2011 00:00:00 GMT+0400"
Date.today().setWeek(52).toString()
"Mon Dec 24 2012 00:00:00 GMT+0400"
To fix this issue, replace setWeek function code with following (not 100%
tested):
return this.addDays( (1 - this.getDay() ) % 7).addWeeks(n-this.getWeek());
Date.today().setWeek(52).toString()
"Mon Dec 26 2011 00:00:00 GMT+0400"
```
Original issue reported on code.google.com by `d.chekanov` on 28 Dec 2011 at 9:03
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.