mirror of
https://github.com/samsonjs/strftime.git
synced 2026-04-26 14:47:43 +00:00
Revert "Fixes #56 (Bug in %U)"
This commit is contained in:
parent
603a716bf8
commit
ab3d4a052e
2 changed files with 2 additions and 7 deletions
|
|
@ -595,10 +595,8 @@
|
||||||
else
|
else
|
||||||
weekday--;
|
weekday--;
|
||||||
}
|
}
|
||||||
|
var firstDayOfYear = new Date(date.getFullYear(), 0, 1),
|
||||||
var firstDayOfYearUtc = Date.UTC(date.getFullYear(), 0, 1),
|
yday = (date - firstDayOfYear) / 86400000,
|
||||||
dateUtc = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()),
|
|
||||||
yday = Math.floor((dateUtc - firstDayOfYearUtc) / 86400000),
|
|
||||||
weekNum = (yday + 7 - weekday) / 7;
|
weekNum = (yday + 7 - weekday) / 7;
|
||||||
|
|
||||||
return Math.floor(weekNum);
|
return Math.floor(weekNum);
|
||||||
|
|
|
||||||
3
test.js
3
test.js
|
|
@ -115,9 +115,6 @@ assert.format('%z', null, '+0000');
|
||||||
assert.format('%:z', null, '+00:00');
|
assert.format('%:z', null, '+00:00');
|
||||||
assert.format('%%', '%'); // any other char
|
assert.format('%%', '%'); // any other char
|
||||||
assert.format('%F %T', null, '1970-01-01 00:00:00', new Date(0));
|
assert.format('%F %T', null, '1970-01-01 00:00:00', new Date(0));
|
||||||
assert.format('%U', '13', "12", (new Date('03-26-2017 00:00:00')));
|
|
||||||
assert.format('%U', '13', null, (new Date('03-27-2017 00:00:00')));
|
|
||||||
assert.format('%U', '14', "13", (new Date('04-02-2017 00:00:00')));
|
|
||||||
ok('GMT');
|
ok('GMT');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue