Date: 16/08/2026 12:03:32
Issue: Tanggal di form AddFuelPage masih menampilkan format mm/dd/yyyy
User Report: "tanggal pengisian fuel di form Add/edit masih mm/dd/yyyy, kenapa ya?"
Root Cause: Implementasi date picker dan data binding tidak sinkron dengan benar
<q-input
v-model="fuelData.Tgl"
mask="##/##/####"
>
<q-date
v-model="dateProxy"
mask="DD/MM/YYYY"
/>
</q-input>
// Problematic conversion
const updateDateFromPicker = (value) => {
// Complex conversion logic
}
<q-input
v-model="displayDate"
mask="##/##/####"
@update:model-value="updateDateValue"
>
<q-date
v-model="internalDateProxy"
mask="YYYY/MM/DD"
@update:model-value="onDatePickerChange"
/>
</q-input>
// Simplified and reliable
const onDatePickerChange = (pickerValue) => {
if (pickerValue) {
const parts = pickerValue.split('/')
const indonesianDate = `${parts[2]}/${parts[1]}/${parts[0]}`
displayDate.value = indonesianDate
fuelData.value.Tgl = indonesianDate
}
}
| Aspect | Before | After | Benefit |
|---|---|---|---|
| Data Binding | Direct v-model="fuelData.Tgl" | Separate displayDate with sync | Better control over data flow |
| Date Picker | mask="DD/MM/YYYY" | mask="YYYY/MM/DD" | Matches Quasar internal format |
| Conversion | Complex bidirectional | Simple one-way conversion | Less error-prone |
| Synchronization | Manual sync in multiple places | Centralized sync functions | Consistent behavior |
// Separate display date for better control
const displayDate = ref(getCurrentDate())
// Update display date and sync with fuelData
const updateDateValue = (newValue) => {
displayDate.value = newValue
fuelData.value.Tgl = newValue
}
// Handle date picker selection
const onDatePickerChange = (pickerValue) => {
if (pickerValue) {
const parts = pickerValue.split('/')
const indonesianDate = `${parts[2]}/${parts[1]}/${parts[0]}`
displayDate.value = indonesianDate
fuelData.value.Tgl = indonesianDate
}
}
// Convert to picker format (YYYY/MM/DD)
const toPickerFormat = (indonesianDate) => {
const parts = indonesianDate.split('/')
return `${parts[2]}/${parts[1]}/${parts[0]}`
}
| Issue | Symptom | Solution |
|---|---|---|
| Date Picker Not Syncing | Calendar shows different date than input | Check internalDateProxy initialization |
| Format Still Wrong | Still shows mm/dd/yyyy | Clear browser cache, check locale settings |
| Validation Failing | Valid dates rejected | Check isValidIndonesianDate regex |
| Save Error | Date not saving to database | Check date conversion in saveFuel function |
// Check current values in browser console
console.log('displayDate:', displayDate.value)
console.log('fuelData.Tgl:', fuelData.value.Tgl)
console.log('internalDateProxy:', internalDateProxy.value)
// Test date conversion
const testDate = '19/01/2026'
console.log('To picker format:', toPickerFormat(testDate))
| Test Case | Expected Result | Status |
|---|---|---|
| Page Load | Input shows today's date as DD/MM/YYYY | โ Fixed |
| Manual Input | User can type DD/MM/YYYY format | โ Fixed |
| Date Picker | Calendar selection updates input as DD/MM/YYYY | โ Fixed |
| Edit Mode | Database date loads as DD/MM/YYYY | โ Fixed |
| Form Submit | Date converts to YYYY-MM-DD for API | โ Fixed |
| Validation | Indonesian date validation works | โ Fixed |
Generated by: test_fix_date_format_addfuel.php | Author: Rodhi | Date: 16/08/2026 12:03:32