fix createAt updatedAt types

This commit is contained in:
Thomas Ruoff
2025-03-26 23:21:27 +01:00
parent d5ac2f09dc
commit d149f326ed
2 changed files with 9 additions and 15 deletions

View File

@@ -4,11 +4,7 @@ import Link from 'next/link'
import { daysFormatFrontend } from '../helpers/date'
import { IBooking } from '../db/booking'
export default function BookingTable({
booking,
}: {
booking: IBooking
}) {
export default function BookingTable({ booking }: { booking: IBooking }) {
const data = [
{ name: 'Status', value: booking.status },
{ name: 'Buchungszeitraum', value: daysFormatFrontend(booking.days) },
@@ -50,16 +46,11 @@ export default function BookingTable({
</Link>
</h3>
<p className="mt-1 max-w-2xl text-sm text-gray-500">
Created{' '}
{new Date(booking.createdAt).toLocaleString(
new Intl.Locale('de')
)}
Created {booking.createdAt?.toLocaleString(new Intl.Locale('de'))}
</p>
<p className="mt-1 max-w-2xl text-sm text-gray-500">
Last updated{' '}
{new Date(booking.updatedAt as string).toLocaleString(
new Intl.Locale('de')
)}
{booking.updatedAt?.toLocaleString(new Intl.Locale('de'))}
</p>
</div>
<div className="border-t border-gray-200">
@@ -67,8 +58,9 @@ export default function BookingTable({
{data.map(({ name, value }, index) => (
<div
key={`${booking.uuid}-${name}`}
className={`${index % 2 === 1 ? 'bg-white' : 'bg-gray-100'
} px-2 py-3 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6`}
className={`${
index % 2 === 1 ? 'bg-white' : 'bg-gray-100'
} px-2 py-3 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6`}
>
<dt className="text-sm font-medium text-gray-500">{name}</dt>
<dd className="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
@@ -80,4 +72,4 @@ export default function BookingTable({
</div>
</div>
)
}
}

View File

@@ -28,6 +28,8 @@ export interface IBooking {
destination?: string
days?: string[]
calendarEventId?: string
createdAt?: NativeDate
updatedAt?: NativeDate
toJSON?: () => IBooking
}