fix: 动态时间组件

This commit is contained in:
fit2cloud-chenyw
2022-01-07 14:14:22 +08:00
parent 009cdaaab9
commit dc4c9ca3ac
3 changed files with 11 additions and 6 deletions

View File

@@ -114,10 +114,8 @@ class TimeDateServiceImpl extends WidgetService {
const tarYear = nowYear
if (dynamicSuffix === 'before') {
const deffMonth = nowMonth - dynamicPrefix
let diffYear = deffMonth / 12
if (deffMonth < 0) {
diffYear -= 1
}
const diffYear = Math.floor(deffMonth / 12)
return new Date(tarYear + diffYear, nowMonth - dynamicPrefix % 12, nowDate).getTime()
} else {
const deffMonth = nowMonth + dynamicPrefix