Skip to content

add component DateGate conditionally render content based on build-time date - #1845

Open
nikoshell wants to merge 1 commit into
ep2026from
ep2026-scope
Open

add component DateGate conditionally render content based on build-time date#1845
nikoshell wants to merge 1 commit into
ep2026from
ep2026-scope

Conversation

@nikoshell

Copy link
Copy Markdown
Contributor

No description provided.

@europython-society

Copy link
Copy Markdown
Member

Preview available

Key Value
url https://ep2026-scope.ep-preview.click
last update 2026-08-08T09:25:08.711Z

@nikoshell nikoshell self-assigned this Aug 8, 2026
@nikoshell
nikoshell requested review from artcz and hypha August 8, 2026 18:07

@hypha hypha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor non-blocking comments and sorry for the delay.

<a class="nav-link-btn" href="/tickets">Register Now</a>
</li>
<DateGate before="2026-07-20">
<Fragment slot="before">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m confused here. so when only before="2026-07-20" is provided, the beforeDate selects during up to 20 Jul and after afterward, right? If so, it never selects before, so this slot="before" fragment doesn't reach / render? Then isn't it just a dup of during fragment?

Also, could we give an example to the the before-only case in DateGate to help with the confusedpoke?

<a href="/tickets" class="nav-cta">Register Now</a>
</Fragment>
<Fragment slot="after">
<span class="nav-cta" style="opacity:0.5;cursor:default"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opacity: 0.5 here fades both the txt and bg into the navbar, so in lightmode, the "see you next year" is so faint that I barely think you mean it. 😢 Maybe remove the opacity and give this post-event label its own txt and bg colour, or something else cleverer, to increase the contrast and sincerity of wanting to see us next year?

// DateTime strings with offset (e.g. "...T00:00:00+02:00") parse correctly.
const parseDate = (s: string): Date => {
const iso = s.includes("T") ? s : `${s}T00:00:00.000Z`;
return new Date(iso);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is it a good idea for parseDate to check if it produced a valid date and throw a build error if not? Like if i have a typo, e.g. before="2026-13-20", that's an invalid date, I think in the before-only case, comparing now with that invalid date returns false, so we select during and will continue to show the gated content instead of reporting the typo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants