-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove time from event startDate / endDate fields in the CMS #1091
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Think it's unrelated to this PR, but I was able to create an event without SEO description, and zod started screaming.
|
Suuuper random edge case, but we allow start-date to be after end-date. Example: start-date: 2025-02-12 |
if (!endDate) { | ||
return [formattedStartDate, location] | ||
} | ||
|
||
if (isSameDay(startDate, endDate)) { | ||
return [formattedStartDate, location] | ||
} | ||
|
||
const formattedEndDate = formatDate(endDate) | ||
const dateRange = `${formattedStartDate} - ${formattedEndDate}` | ||
|
||
return [dateRange, location] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this reads nicely 😊
start-date: 2022-08-24 | ||
end-date: 2022-08-22 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the other way around? 🧐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should definitely be the other way around 😅 And that's a good catch! Nothing prevents the author from doing this, I'll add a Zod validation to catch these mistakes for us 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@barbaraperic This has been fixed in #1098 |
@@ -7,8 +7,8 @@ category: supported-sponsored | |||
location: | |||
primary: San Francisco, CA | |||
region: north-america | |||
start-date: 2024-05-14T15:48:19.518Z | |||
end-date: 2024-05-15T15:48:19.530Z | |||
start-date: 2024-05-14 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we tested this using Chrome DevTools → Network tab → More tools → Sensors?
I’m concerned that some systems (browsers) might assume the date is in local time, especially if they automatically attach a time zone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a valid concern!
When logging the data here I see this, which is what we want!
startDate 2024-11-06T00:00:00.000Z
endDate 2024-11-12T00:00:00.000Z
But I'll play with the Sensors and see if we get different results in the US vs Asia.
Yes, this is not related to this PR, this is how Decap works. It doesn't delete fields sadly 🥲 |
📝 Description
This PR updates the event's
startDate
/endDate
fields by removing the time portion. This will improve the CMS UX for the content team, standardize the data and make things clearer for us.🛠️ Key Changes
config.yml
with new datetime format - 7a61172getMetaData
to display a single date if the start and end dates are the same.🧪 How to Test
Run the CMS locally, create an event and make sure the start and end times are only dates, not times.
📸 Screenshots
🔖 Resources