#69 feat(Reconciliation): improve datetime on form.

This commit is contained in:
Mono Mono 2024-11-16 23:10:43 -05:00
parent 9aa543662b
commit bd6d4221b2

View File

@ -8,9 +8,10 @@
<v-text-field
v-model="reconciliation.datetime"
label="Fecha"
type="date"
type="datetime-local"
:rules="[rules.required]"
required
readonly
></v-text-field>
<v-text-field
v-model="reconciliation.cashman"
@ -115,6 +116,7 @@
},
mounted() {
this.reconciliation.total_cash_purchases = this.totalByMethod('cash');
this.reconciliation.datetime = this.getCurrentDate();
},
watch: {
'reconciliation.cash_taken'() {
@ -130,7 +132,15 @@
},
updateDiscrepancy() {
this.reconciliation.cash_discrepancy = (this.reconciliation.total_cash_purchases || 0 ) - (this.reconciliation.cash_taken || 0);
}
},
getCurrentDate() {
const today = new Date();
const gmtOffSet = -5;
const localDate = new Date(today.getTime() + (gmtOffSet * 60 * 60 * 1000));
// Formatear la fecha y hora en el formato YYYY-MM-DDTHH:MM
const formattedDate = localDate.toISOString().slice(0,16);
return formattedDate;
},
},
}
</script>