Commit f8df7209 by 前端

Merge branch 'xuyl_dev_v2.12.0' into 'v2.12.0'

上一个月日期处理

See merge request !44
2 parents 54292f79 79276dfd
......@@ -8,16 +8,19 @@ export const nearlyAMonth = {
created() {
let date = new Date()
let year = date.getFullYear()
let preYear = date.getFullYear()
let month = date.getMonth() + 1
let day = date.getDate()
let aheadOfMonth = month == '1' ? '12' : month - 1
let preDays = this.mGetDate(year, aheadOfMonth)
// let curDays = this.mGetDate(year, month)
if (aheadOfMonth == '12') {
preYear = preYear - 1
}
this.defalutEndTime = year + '-' + month + '-' + day
if (day > preDays) {
this.defalutStartTime = year + '-' + aheadOfMonth + '-' + preDays
this.defalutStartTime = preYear + '-' + aheadOfMonth + '-' + preDays
} else {
this.defalutStartTime = year + '-' + aheadOfMonth + '-' + day
this.defalutStartTime = preYear + '-' + aheadOfMonth + '-' + day
}
},
methods: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!