Files
web/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Dates/index.tsx
Anton Gunnarsson 1bd8fe6821 Merged in feat/sw-2879-booking-widget-to-booking-flow-package (pull request #2532)
feat(SW-2879): Move BookingWidget to booking-flow package

* Fix lockfile

* Fix styling

* a tiny little booking widget test

* Tiny fixes

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package

* Remove unused scripts

* lint:fix

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package

* Tiny lint fixes

* update test

* Update Input in booking-flow

* Clean up comments etc

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package

* Setup tracking context for booking-flow

* Add missing use client

* Fix temp tracking function

* Pass booking to booking-widget

* Remove comment

* Add use client to booking widget tracking provider

* Add use client to tracking functions

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package

* Move debug page

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package


Approved-by: Bianca Widstam
2025-08-05 09:20:20 +00:00

55 lines
1.7 KiB
TypeScript

"use client"
import { useIntl } from "react-intl"
import { shortDateFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { useMyStayStore } from "@/stores/my-stay"
import useLang from "@/hooks/useLang"
import styles from "./dates.module.css"
export default function Dates() {
const intl = useIntl()
const lang = useLang()
const { checkInDate, checkOutDate } = useMyStayStore((state) => ({
checkInDate: state.bookedRoom.checkInDate,
checkOutDate: state.bookedRoom.checkOutDate,
}))
const from = dt(checkInDate).locale(lang).format(shortDateFormat[lang])
const fromYear = dt(checkInDate).year()
const to = dt(checkOutDate).locale(lang).format(shortDateFormat[lang])
const toYear = dt(checkOutDate).year()
const isSameYear = fromYear === toYear
const stayFrom = isSameYear ? from : `${from}, ${fromYear}`
const stayTo = `${to}, ${toYear}`
return (
<div className={styles.row}>
<div className={styles.label}>
<MaterialIcon icon="calendar_month" />
<Typography variant="Body/Paragraph/mdRegular">
<p className={styles.textDefault}>
{intl.formatMessage({
defaultMessage: "Dates",
})}
</p>
</Typography>
</div>
<Typography variant="Body/Paragraph/mdRegular">
<p className={styles.textDefault}>
{/* eslint-disable formatjs/no-literal-string-in-jsx */}
{stayFrom} {stayTo}
</p>
</Typography>
</div>
)
}