1
0
mirror of synced 2026-04-27 10:48:42 +08:00

修复出现第0周的问题

This commit is contained in:
6tail
2020-05-04 08:28:02 +08:00
parent a0714907e8
commit 94189f364b

View File

@@ -148,6 +148,9 @@ public class SolarWeek {
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
c.set(year,month-1,1); c.set(year,month-1,1);
int firstDayWeek = c.get(Calendar.DAY_OF_WEEK)-1; int firstDayWeek = c.get(Calendar.DAY_OF_WEEK)-1;
if(firstDayWeek==0){
firstDayWeek = 7;
}
return (int)Math.ceil((day+firstDayWeek-start)/7D); return (int)Math.ceil((day+firstDayWeek-start)/7D);
} }