fix: LocalDateTimeUtils.getDateRangeList计算季度区间有误
This commit is contained in:
parent
44c22e1ef5
commit
84140c52b0
@ -249,8 +249,11 @@ public class LocalDateTimeUtils {
|
||||
break;
|
||||
case DateIntervalEnum.QUARTER:
|
||||
while (startTime.isBefore(endTime)) {
|
||||
LocalDateTime quarterEnd = startTime.withMonth(getQuarterOfYear(startTime) * 3 + 1)
|
||||
.withDayOfMonth(1).minusNanos(1);
|
||||
int quarterOfYear = getQuarterOfYear(startTime);
|
||||
LocalDateTime quarterEnd =
|
||||
quarterOfYear == 4
|
||||
? startTime.with(TemporalAdjusters.lastDayOfYear()).plusDays(1).minusNanos(1)
|
||||
: startTime.withMonth(quarterOfYear * 3 + 1).withDayOfMonth(1).minusNanos(1);
|
||||
timeRanges.add(new LocalDateTime[]{startTime, quarterEnd});
|
||||
startTime = quarterEnd.plusNanos(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user