Skip to content

Commit

Permalink
v1.6.7 修复星期错误的问题。
Browse files Browse the repository at this point in the history
  • Loading branch information
6tail committed Nov 9, 2023
1 parent 80a96cb commit 6581f01
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions __tests__/SolarWeek.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,13 @@ test('test9', () => {
test('test10', () => {
expect(Solar.fromYmd(9865, 7, 26).getWeek()).toBe(3);
});

test('test11', () => {
expect(Solar.fromYmd(1961, 9, 30).getWeek()).toBe(6);
expect(Solar.fromYmdHms(1961, 9, 30, 23, 59, 59).getWeek()).toBe(6);
});

test('test12', () => {
expect(Solar.fromYmdHms(2021, 9, 15, 0, 0, 0).getWeek()).toBe(3);
expect(Solar.fromYmdHms(2021, 9, 15, 23, 59, 59).getWeek()).toBe(3);
});
2 changes: 1 addition & 1 deletion lunar.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
return this._p.second;
},
getWeek:function(){
return (Math.floor(this.getJulianDay()) + 7000002) % 7;
return (Math.floor(this.getJulianDay() + 0.5) + 7000001) % 7;
},
getWeekInChinese:function(){
return SolarUtil.WEEK[this.getWeek()];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lunar-javascript",
"version": "1.6.6",
"version": "1.6.7",
"description": "lunar is a calendar library for Solar and Chinese Lunar.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 6581f01

Please sign in to comment.