Prefill with today fixes (#87)
This commit is contained in:
parent
049649a81e
commit
7b5968401b
|
@ -94,7 +94,7 @@ export default {
|
||||||
this.compVal = null
|
this.compVal = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
immediate: true
|
immediate: false
|
||||||
},
|
},
|
||||||
toDate: {
|
toDate: {
|
||||||
handler(val) {
|
handler(val) {
|
||||||
|
@ -107,7 +107,7 @@ export default {
|
||||||
this.compVal = null
|
this.compVal = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
immediate: true
|
immediate: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -350,9 +350,13 @@ export default {
|
||||||
formData[field.id] = urlPrefill.getAll(field.id + '[]')
|
formData[field.id] = urlPrefill.getAll(field.id + '[]')
|
||||||
} else if (field.type === 'date' && field.prefill_today === true) { // For Prefill with 'today'
|
} else if (field.type === 'date' && field.prefill_today === true) { // For Prefill with 'today'
|
||||||
const dateObj = new Date()
|
const dateObj = new Date()
|
||||||
const currentDate = dateObj.getFullYear() + '-' +
|
let currentDate = dateObj.getFullYear() + '-' +
|
||||||
String(dateObj.getMonth() + 1).padStart(2, '0') + '-' +
|
String(dateObj.getMonth() + 1).padStart(2, '0') + '-' +
|
||||||
String(dateObj.getDate()).padStart(2, '0')
|
String(dateObj.getDate()).padStart(2, '0')
|
||||||
|
if(field.with_time === true){
|
||||||
|
currentDate += 'T' + String(dateObj.getHours()).padStart(2, '0') + ':' +
|
||||||
|
String(dateObj.getMinutes()).padStart(2, '0');
|
||||||
|
}
|
||||||
formData[field.id] = currentDate
|
formData[field.id] = currentDate
|
||||||
} else { // Default prefill if any
|
} else { // Default prefill if any
|
||||||
formData[field.id] = field.prefill
|
formData[field.id] = field.prefill
|
||||||
|
|
Loading…
Reference in New Issue