🐛 Trip day: fix trip day date timezone issue
This commit is contained in:
parent
aeecfd4191
commit
2b2971a6c9
@ -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() {
|
closeDialog() {
|
||||||
// Normalize data for API POST
|
// Normalize data for API POST
|
||||||
let ret = this.dayForm.value;
|
let ret = this.dayForm.value;
|
||||||
if (!ret['label']) return;
|
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);
|
this.ref.close(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user