🐛 Trip day: fix trip day date timezone issue

This commit is contained in:
itskovacs 2025-10-28 18:11:19 +01:00
parent aeecfd4191
commit 2b2971a6c9

View File

@ -35,11 +35,18 @@ export class TripCreateDayModalComponent {
}
}
formatDateWithoutTimezone(date: Date) {
const year = date.getUTCFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
closeDialog() {
// Normalize data for API POST
let ret = this.dayForm.value;
if (!ret['label']) return;
if (ret['dt']) ret['dt'] = ret['dt'].toISOString().split('T')[0];
if (ret['dt']) ret['dt'] = this.formatDateWithoutTimezone(ret['dt']);
this.ref.close(ret);
}
}