add payment, trust badge, handle race condition, fix booking schema
This commit is contained in:
@@ -81,3 +81,30 @@ export function isPastTripLastDayForReview(
|
||||
);
|
||||
return Date.now() > endMs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tampilkan tanggal trip untuk UI: pakai **kalender UTC** (sama dengan
|
||||
* `tripStoredInstantFromYmd` & filter Open Trip), supaya tidak bergeser
|
||||
* karena timezone runtime (server vs browser).
|
||||
*/
|
||||
export function formatTripCalendarDateLong(
|
||||
d: Date | string,
|
||||
locale = "id-ID"
|
||||
): string {
|
||||
const date = typeof d === "string" ? new Date(d) : d;
|
||||
return new Intl.DateTimeFormat(locale, {
|
||||
dateStyle: "long",
|
||||
timeZone: "UTC",
|
||||
}).format(date);
|
||||
}
|
||||
|
||||
export function formatTripCalendarDateRangeLong(
|
||||
start: Date | string,
|
||||
end?: Date | string | null,
|
||||
locale = "id-ID"
|
||||
): string {
|
||||
const startStr = formatTripCalendarDateLong(start, locale);
|
||||
if (!end) return startStr;
|
||||
const endStr = formatTripCalendarDateLong(end, locale);
|
||||
return `${startStr} — ${endStr}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user