feat(events): pipe displayTimezone through list and sidebar formatters
Sidebar (EventsMiniSidebar), public events list, member dashboard "Upcoming" block, and EventTicketPurchase all formatted dates in viewer-local TZ. Switch each formatter to accept the event (or an eventTimezone prop) and pass it to Intl.DateTimeFormat so the displayed wall-clock matches the event's intended zone.
This commit is contained in:
parent
acbd3c0737
commit
9dd007657a
5 changed files with 40 additions and 25 deletions
|
|
@ -231,6 +231,10 @@ const props = defineProps({
|
|||
type: String,
|
||||
required: true,
|
||||
},
|
||||
eventTimezone: {
|
||||
type: String,
|
||||
default: "America/Toronto",
|
||||
},
|
||||
userEmail: {
|
||||
type: String,
|
||||
default: null,
|
||||
|
|
@ -415,6 +419,7 @@ const formatEventDate = (date) => {
|
|||
month: "long",
|
||||
day: "numeric",
|
||||
year: "numeric",
|
||||
timeZone: props.eventTimezone || "America/Toronto",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<div v-if="events?.length" class="em-rows">
|
||||
<div v-for="event in events" :key="event._id" class="em-item">
|
||||
<div class="em-inset em-item-body">
|
||||
<span class="em-date">{{ formatDate(event.startDate) }}</span>
|
||||
<span class="em-date">{{ formatDate(event) }}</span>
|
||||
<NuxtLink
|
||||
:to="`/events/${event.slug || event._id}`"
|
||||
class="em-title"
|
||||
|
|
@ -37,10 +37,13 @@ defineProps({
|
|||
events: { type: Array, default: () => [] },
|
||||
});
|
||||
|
||||
const formatDate = (dateStr) => {
|
||||
if (!dateStr) return "";
|
||||
const d = new Date(dateStr);
|
||||
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
||||
const formatDate = (event) => {
|
||||
if (!event?.startDate) return "";
|
||||
return new Date(event.startDate).toLocaleDateString("en-US", {
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
timeZone: event.displayTimezone || "America/Toronto",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue