Skip to content

Commit

Permalink
fix: Add a display date
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Voccia committed Nov 1, 2024
1 parent cfb25f7 commit 241d8ea
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/components/EventDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { region } from "~/config";

interface EventDetailsProps {
date: Date;
displayDate: string;
link: string;
linkText: string;
location: string;
Expand All @@ -12,6 +13,7 @@ interface EventDetailsProps {

export function EventDetails({
date,
displayDate,
link,
location,
linkText,
Expand All @@ -36,7 +38,7 @@ export function EventDetails({
} catch (ex) {
console.log("Date:", date);
console.log("Error:", ex);
strDate = "Unknown";
strDate = displayDate;
}
}

Expand Down
2 changes: 2 additions & 0 deletions app/data/events.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"date": "2024-12-12T18:00:00.000-05:00",
"displayDate": "December 12",
"duration": {
"hours": 2
},
Expand All @@ -10,6 +11,7 @@
},
{
"date": "2024-11-14T18:00:00.000-05:00",
"displayDate": "November 14",
"duration": {
"hours": 2
},
Expand Down
2 changes: 2 additions & 0 deletions app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export function loader() {
const events = eventsJson.map((event) => ({
...event,
date: new Date(event.date),
displayDate: event.displayDate ?? "Missing Display Date",
}));

// This assumes we'll always have a rebuild of the site after an event finishes.
Expand Down Expand Up @@ -46,6 +47,7 @@ export default function Index() {
{events.map((event, index) => (
<EventDetails
date={event.date}
displayDate={event.displayDate}
key={index}
link={event.link}
linkText="Register Now"
Expand Down
3 changes: 3 additions & 0 deletions app/routes/events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export default function Events() {
{events.map((event) => (
<EventDetails
date={new Date(event.date)}
displayDate={
event.displayDate ?? "Missing Display Date"
}
key={event.date}
link={event.link}
linkText="Details"
Expand Down

0 comments on commit 241d8ea

Please sign in to comment.