add payment, trust badge, handle race condition, fix booking schema

This commit is contained in:
arifal
2026-04-20 23:57:31 +07:00
parent ba5f64ae0e
commit fcdca34460
33 changed files with 1781 additions and 138 deletions
+27
View File
@@ -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}`;
}