fix: make sure calculations in booking flow are correct

This commit is contained in:
Simon Emanuelsson
2025-04-02 15:49:59 +02:00
committed by Michael Zetterberg
parent 3e0f503314
commit a222ecfc5c
28 changed files with 309 additions and 276 deletions

View File

@@ -75,6 +75,9 @@ export default function PriceDetailsModal() {
return null
}
const checkInDate = dt(fromDate).format("YYYY-MM-DD")
const checkOutDate = dt(toDate).format("YYYY-MM-DD")
const bookingTotal = rooms.reduce(
(acc, room) => {
if (room) {
@@ -89,7 +92,7 @@ export default function PriceDetailsModal() {
{ price: 0, priceExVat: 0, vatAmount: 0 }
)
const diff = dt(toDate).diff(fromDate, "days")
const diff = dt(checkOutDate).diff(checkInDate, "days")
const nights = intl.formatMessage(
{ id: "{totalNights, plural, one {# night} other {# nights}}" },
{ totalNights: diff }