diff --git a/frontend/src/components/ListingDetail.tsx b/frontend/src/components/ListingDetail.tsx index 56d1e7f..ff86995 100644 --- a/frontend/src/components/ListingDetail.tsx +++ b/frontend/src/components/ListingDetail.tsx @@ -3,6 +3,12 @@ import { Button } from './ui/button'; import { PhotoCarousel } from './PhotoCarousel'; import type { ListingDetailData, DecisionType, POIDistanceInfo } from '@/types'; +function formatDate(value: string): string { + const date = new Date(value); + if (isNaN(date.getTime())) return value; + return date.toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' }); +} + interface ListingDetailProps { detail: ListingDetailData; onDecide: (decision: DecisionType) => void; @@ -139,7 +145,7 @@ export function ListingDetail({ detail, onDecide, onClearDecision }: ListingDeta {detail.available_from && (
- Available {detail.available_from} + Available {formatDate(detail.available_from)}
)} {detail.service_charge != null && ( diff --git a/frontend/src/components/PropertyCard.tsx b/frontend/src/components/PropertyCard.tsx index b0a632e..953b85c 100644 --- a/frontend/src/components/PropertyCard.tsx +++ b/frontend/src/components/PropertyCard.tsx @@ -2,6 +2,12 @@ import { ExternalLink, Bed, Maximize2, PoundSterling, Clock, Building, Footprint import { Button } from './ui/button'; import type { PropertyProperties, POIDistanceInfo, POI } from '@/types'; +function formatDate(value: string): string { + const date = new Date(value); + if (isNaN(date.getTime())) return value; + return date.toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' }); +} + function formatDuration(seconds: number): string { const minutes = Math.round(seconds / 60); if (minutes < 60) return `${minutes}m`; @@ -231,7 +237,7 @@ export function PropertyCard({ {property.listing_type !== 'BUY' && property.available_from && (
- Available {property.available_from} + Available {formatDate(property.available_from)}
)} {property.listing_type === 'BUY' && (