fix date range issue in reports

This commit is contained in:
raishvaria
2020-12-07 12:34:12 +05:30
parent fd3742b926
commit 599e6270e8
4 changed files with 62 additions and 35 deletions

View File

@ -162,6 +162,14 @@ export default {
return this.$t('validation.required')
}
},
dateRangeUrl () {
return `${this.siteURL}?from_date=${moment(
this.formData.from_date
).format('YYYY-MM-DD')}&to_date=${moment(this.formData.to_date).format(
'YYYY-MM-DD'
)}`
}
},
watch: {
@ -173,17 +181,14 @@ export default {
mounted() {
this.siteURL = `/reports/profit-loss/${this.getSelectedCompany.unique_hash}`
this.url = `${this.siteURL}?from_date=${moment(
this.formData.from_date
).format('YYYY-MM-DD')}&to_date=${moment(this.formData.to_date).format(
'YYYY-MM-DD'
)}`
this.url = this.dateRangeUrl
},
methods: {
getThisDate(type, time) {
return moment()[type](time).toString()
},
getPreDate(type, time) {
return moment().subtract(1, time)[type](time).toString()
},
@ -257,7 +262,7 @@ export default {
return true
}
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
this.url = this.dateRangeUrl
return true
},
@ -268,7 +273,7 @@ export default {
window.open(this.getReportUrl + '&download=true')
setTimeout(() => {
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
this.url = this.dateRangeUrl
}, 200)
},
},