Bug 32030: Fix date handling - conflicts with bug 30718

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2022-10-21 12:00:22 +02:00 committed by Tomas Cohen Arazi
parent e8222d6074
commit 8fa88f3e98
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
6 changed files with 3 additions and 44 deletions

View File

@ -73,22 +73,11 @@ export default {
data() {
return {
fp_config: flatpickr_defaults,
dates_fixed: 0,
}
},
props: {
periods: Array
},
beforeCreate() {
if (!this.dates_fixed) {
this.periods.forEach(p => {
p.started_on = $date(p.started_on)
p.ended_on = $date(p.ended_on)
p.cancellation_deadline = $date(p.cancellation_deadline)
})
this.dates_fixed = 1
}
},
methods: {
addPeriod() {
this.periods.push({

View File

@ -304,12 +304,6 @@ export default {
agreement.vendor_id = null
}
agreement.periods.forEach(p => {
p.started_on = $date_to_rfc3339(p.started_on)
p.ended_on = p.ended_on ? $date_to_rfc3339(p.ended_on) : null
p.cancellation_deadline = p.cancellation_deadline ? $date_to_rfc3339(p.cancellation_deadline) : null
})
agreement.periods = agreement.periods.map(({ agreement_id, agreement_period_id, ...keepAttrs }) => keepAttrs)
agreement.user_roles = agreement.user_roles.map(({ patron, patron_str, ...keepAttrs }) => keepAttrs)

View File

@ -60,7 +60,7 @@ export default {
},
data: function () {
return {
fp_config: flatpickr_defaults, dates_fixed: 0,
fp_config: flatpickr_defaults,
agreements: [],
initialized: false,
filters: {
@ -84,7 +84,7 @@ export default {
datatable_url() {
let url = '/api/v1/erm/agreements'
if (this.filters.by_expired)
url += '?max_expiration_date=' + $date_to_rfc3339(this.filters.max_expiration_date)
url += '?max_expiration_date=' + this.filters.max_expiration_date
return url
}
},

View File

@ -483,11 +483,6 @@ export default {
delete title.title_id
delete title.biblio_id
title.resources.forEach(r => {
r.started_on = r.started_on ? $date_to_rfc3339(r.started_on) : null
r.ended_on = r.ended_on ? $date_to_rfc3339(r.ended_on) : null
})
// Cannot use the map/keepAttrs because of the reserved keywork 'package'
title.resources.forEach(function (e) { delete e.package; delete e.resource_id })

View File

@ -107,18 +107,10 @@ export default {
return {
packages: [],
fp_config: flatpickr_defaults,
dates_fixed: 0,
}
},
beforeCreate() {
fetchLocalPackages().then((packages) => this.packages = packages)
if (!this.dates_fixed) {
this.resources.forEach(r => {
r.started_on = $date(r.started_on)
r.ended_on = $date(r.ended_on)
})
this.dates_fixed = 1
}
},
methods: {
addPackage() {

View File

@ -153,8 +153,7 @@ export default {
},
data() {
return {
fp_config: flatpickr_defaults, dates_fixed: 0,
fp_config: flatpickr_defaults,
license: {
license_id: null,
name: '',
@ -169,13 +168,6 @@ export default {
initialized: false,
}
},
beforeUpdate() {
if (!this.dates_fixed) {
this.license.started_on = $date(this.license.started_on)
this.license.ended_on = $date(this.license.ended_on)
this.dates_fixed = 1
}
},
beforeRouteEnter(to, from, next) {
next(vm => {
if (to.params.license_id) {
@ -209,9 +201,6 @@ export default {
license.vendor_id = null
}
license.started_on = license.started_on ? $date_to_rfc3339(license.started_on) : null
license.ended_on = license.ended_on ? $date_to_rfc3339(license.ended_on) : null
license.documents = license.documents.map(({ file_type, uploaded_on, ...keepAttrs }) => keepAttrs)
const options = {