← All changes
|
resources/js/components/dashboard/RecentBookings.tsx
+6
-2
3.0.6
→
3.0.17
View file →
| @@ -4,8 +4,9 @@ | ||
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | import React from "react"; |
| 7 | 7 | import { __ } from "../../lib/i18n"; |
| 8 | +import { toDateValue } from "../../lib/dateFormat"; | |
| 8 | 9 | import { Card, CardContent, CardHeader, CardTitle } from "../ui/card"; |
| 9 | 10 | import { Badge } from "../ui/badge"; |
| 10 | 11 | import { Calendar, User, ArrowRight } from "lucide-react"; |
| 11 | 12 | import { formatYatraMoney } from "../../lib/currency-display"; |
| @@ -33,10 +34,13 @@ | ||
| 33 | 34 | bookings, |
| 34 | 35 | loading = false, |
| 35 | 36 | onView, |
| 36 | 37 | }) => { |
| 37 | - const formatDate = (dateString: string) => { | |
| 38 | - return new Date(dateString).toLocaleDateString("en-US", { | |
| 38 | + const formatDate = (dateString?: string | null) => { | |
| 39 | + // toDateValue: a date-only booking_date must not roll back a day in behind-UTC zones. | |
| 40 | + const date = toDateValue(dateString); | |
| 41 | + if (isNaN(date.getTime())) return "-"; | |
| 42 | + return date.toLocaleDateString("en-US", { | |
| 39 | 43 | month: "short", |
| 40 | 44 | day: "numeric", |
| 41 | 45 | year: "numeric", |
| 42 | 46 | }); |