feat(sw-697): changed to dt instead of differenceInCalendarDays
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
import { differenceInCalendarDays } from "date-fns"
|
|
||||||
import { useSearchParams } from "next/navigation"
|
import { useSearchParams } from "next/navigation"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { dt } from "@/lib/dt"
|
||||||
|
|
||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||||
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||||
@@ -35,7 +36,7 @@ export default function PriceList({
|
|||||||
let nights = 1
|
let nights = 1
|
||||||
|
|
||||||
if (fromDate && toDate) {
|
if (fromDate && toDate) {
|
||||||
nights = differenceInCalendarDays(new Date(fromDate), new Date(toDate))
|
nights = dt(toDate).diff(dt(fromDate), "days")
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { differenceInCalendarDays } from "date-fns"
|
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { dt } from "@/lib/dt"
|
||||||
|
|
||||||
import Button from "@/components/TempDesignSystem/Button"
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||||
@@ -41,7 +42,7 @@ export default function RateSummary({
|
|||||||
|
|
||||||
const checkInDate = new Date(roomsAvailability.checkInDate)
|
const checkInDate = new Date(roomsAvailability.checkInDate)
|
||||||
const checkOutDate = new Date(roomsAvailability.checkOutDate)
|
const checkOutDate = new Date(roomsAvailability.checkOutDate)
|
||||||
const nights = differenceInCalendarDays(checkOutDate, checkInDate)
|
const nights = dt(checkOutDate).diff(dt(checkInDate), "days")
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.summary}>
|
<div className={styles.summary}>
|
||||||
|
|||||||
Reference in New Issue
Block a user