1
0
mirror of synced 2025-12-26 23:38:00 +08:00

v1.2.18 修复SolarWeek获取当月第几周的错误。

This commit is contained in:
6tail
2022-01-10 20:45:45 +08:00
parent 3e256ddbd3
commit 0a5ea27b20
7 changed files with 114 additions and 32 deletions

View File

@@ -159,10 +159,11 @@ public class SolarWeek {
public int getIndex() {
Calendar c = ExactDate.fromYmd(year, month, 1);
int firstDayWeek = c.get(Calendar.DAY_OF_WEEK) - 1;
if (firstDayWeek == 0) {
firstDayWeek = 7;
int offset = firstDayWeek - start;
if(offset < 0) {
offset += 7;
}
return (int) Math.ceil((day + firstDayWeek - start) / 7D);
return (int) Math.ceil((day + offset) / 7D);
}
/**