mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-08 06:35:19 +02:00
Hide checkout date in calendar for lodging events
This commit is contained in:
parent
dbd417ca87
commit
eb968c3555
1 changed files with 22 additions and 9 deletions
|
@ -119,12 +119,25 @@
|
|||
dates = dates.concat(
|
||||
lodging
|
||||
.filter((i) => i.check_in)
|
||||
.map((lodging) => ({
|
||||
.map((lodging) => {
|
||||
let end = lodging.check_out || lodging.check_in || ''; // Ensure it's a string
|
||||
if (lodging.check_in && lodging.check_out) {
|
||||
let checkInDate = new Date(lodging.check_in);
|
||||
let checkOutDate = new Date(lodging.check_out);
|
||||
if (checkInDate.toDateString() !== checkOutDate.toDateString()) {
|
||||
checkOutDate.setDate(checkOutDate.getDate() - 1);
|
||||
checkOutDate.setHours(23);
|
||||
checkOutDate.setMinutes(59);
|
||||
end = checkOutDate;
|
||||
}
|
||||
}
|
||||
return {
|
||||
id: lodging.id,
|
||||
start: lodging.check_in || '', // Ensure it's a string
|
||||
end: lodging.check_out || lodging.check_in || '', // Ensure it's a string
|
||||
end: end,
|
||||
title: lodging.name
|
||||
}))
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue