Merge pull request #1716 from dataease/pr@v1.7@fix_date_range_quarter

fix: 日期范围动态时间季度错误
This commit is contained in:
fit2cloud-chenyw 2022-01-28 11:02:51 +08:00 committed by GitHub
commit 490fad147e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,7 +125,8 @@ class TimeDateRangeServiceImpl extends WidgetService {
getEndQuarter() {
var now = new Date()
var nowMonth = now.getMonth()
const endMonth = Math.floor((nowMonth / 3)) * 3 + (nowMonth % 3)
const quar = Math.floor(nowMonth / 3)
const endMonth = quar * 3 + 2
const days = (endMonth === 5 || endMonth === 8) ? 30 : 31
return new Date(now.getFullYear(), endMonth, days)
}