feat(sw-697): changed to dt instead of differenceInCalendarDays

This commit is contained in:
Pontus Dreij
2024-11-04 16:29:09 +01:00
parent 04df824ea1
commit 6b5934e2d0
2 changed files with 6 additions and 4 deletions

View File

@@ -1,7 +1,8 @@
import { differenceInCalendarDays } from "date-fns"
import { useSearchParams } from "next/navigation"
import { useIntl } from "react-intl"
import { dt } from "@/lib/dt"
import Body from "@/components/TempDesignSystem/Text/Body"
import Caption from "@/components/TempDesignSystem/Text/Caption"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
@@ -35,7 +36,7 @@ export default function PriceList({
let nights = 1
if (fromDate && toDate) {
nights = differenceInCalendarDays(new Date(fromDate), new Date(toDate))
nights = dt(toDate).diff(dt(fromDate), "days")
}
const {

View File

@@ -1,6 +1,7 @@
import { differenceInCalendarDays } from "date-fns"
import { useIntl } from "react-intl"
import { dt } from "@/lib/dt"
import Button from "@/components/TempDesignSystem/Button"
import Body from "@/components/TempDesignSystem/Text/Body"
import Caption from "@/components/TempDesignSystem/Text/Caption"
@@ -41,7 +42,7 @@ export default function RateSummary({
const checkInDate = new Date(roomsAvailability.checkInDate)
const checkOutDate = new Date(roomsAvailability.checkOutDate)
const nights = differenceInCalendarDays(checkOutDate, checkInDate)
const nights = dt(checkOutDate).diff(dt(checkInDate), "days")
return (
<div className={styles.summary}>