Merged in feat/sw-2874-move-select-rate (pull request #2750)

Approved-by: Joakim Jäderberg
This commit is contained in:
Anton Gunnarsson
2025-09-03 08:30:05 +00:00
parent 8c3f8c74db
commit f7ef58eafa
158 changed files with 708 additions and 735 deletions

View File

@@ -1,4 +1,5 @@
import { type Dayjs, dt } from "@scandic-hotels/common/dt"
import { hasOverlappingDates } from "@scandic-hotels/common/dt/utils/hasOverlappingDates"
import {
MaterialIcon,
type MaterialIconSetIconProps,
@@ -100,44 +101,3 @@ export function filterOverlappingDates<
hasOverlappingDates(item, startDate, endDate)
)
}
export function hasOverlappingDates(
dateRangeItem: {
startDate: Date | Dayjs | string | undefined | null
endDate: Date | Dayjs | string | undefined | null
},
fromDate: Date | Dayjs,
toDate: Date | Dayjs
) {
const startDate = dt(fromDate)
const endDate = dt(toDate)
if (dateRangeItem.endDate && dateRangeItem.startDate) {
const itemStartDate = dt(dateRangeItem.startDate)
const itemEndDate = dt(dateRangeItem.endDate)
const fromDateIsBetweenItemDates = startDate.isBetween(
itemStartDate,
itemEndDate,
"date",
"[]"
)
const toDateIsBetweenItemDates = endDate.isBetween(
itemStartDate,
itemEndDate,
"date",
"[]"
)
const itemFullyContained =
startDate.isSameOrBefore(itemStartDate, "date") &&
endDate.isSameOrAfter(itemEndDate, "date")
return (
fromDateIsBetweenItemDates ||
toDateIsBetweenItemDates ||
itemFullyContained
)
}
return true
}

View File

@@ -0,0 +1,9 @@
// We re-export the NuqsAdapter here to work around issues
// with the consuming apps using nuqs from another module.
// See: https://github.com/47ng/nuqs/issues/798
// We should fix this another way, but moving it to peerDeps
// didn't seem to work so the next solution would be to move
// nuqs to a custom workspace package.
export { NuqsAdapter } from "nuqs/adapters/next/app"