1
0
mirror of synced 2026-04-18 14:28:44 +08:00

Compare commits

...

1 Commits

Author SHA1 Message Date
6tail
6581f01956 v1.6.7 修复星期错误的问题。 2023-11-09 19:28:19 +08:00
3 changed files with 12 additions and 2 deletions

View File

@@ -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);
});

View File

@@ -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()];

View File

@@ -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": {