Skip to content
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

Time Block: Optional link and format. #534

Closed
wants to merge 4 commits into from

Conversation

StevenDufresne
Copy link
Contributor

In building WordPress/wordcamp.org#1124, we need a front-end time block to display a more user-friendly block. There are 2 things that don't work with the current time block:

  • It links to the WorldClock
  • It doesn't allow you to update formatting.

This PR makes the WordClock link optional based on the presence of the data-iso property and allows you to pass in the data format in via data-date-format.

@adamwoodnz adamwoodnz added the [Format] Time Related to the Time format label Dec 6, 2023
@adamwoodnz
Copy link
Contributor

adamwoodnz commented Dec 6, 2023

So how are we intending to use this, just by adding html to be picked up by view.js, as if it was produced by the editor, eg. <time class="wporg-time" datetime="..." data-iso="..." data-date-format="...">{ utcDateDescription }</time>?

This markup is generated on change in the editor, as it's a rich text format, not a standard block.

@StevenDufresne
Copy link
Contributor Author

StevenDufresne commented Dec 6, 2023

So how are we intending to use this, just by adding html to be picked up by view.js, as if it was produced by the editor, eg. <time class="wporg-time" datetime="..." data-iso="..." data-date-format="...">{ utcDateDescription }</time>?

This markup is generated on change in the editor, as it's a rich text format, not a standard block.

Yes.

@adamwoodnz
Copy link
Contributor

Is there a PR with it being used yet?

Copy link
Contributor

@adamwoodnz adamwoodnz left a comment

Choose a reason for hiding this comment

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

Regression tested this in sandbox and looks ok to me.

It would be nice to test with the new usage though.

@StevenDufresne
Copy link
Contributor Author

Not yet. I can get one up.

@StevenDufresne
Copy link
Contributor Author

In the end, I don't think this will be usable for the events page since it replaces everything in the time block, removing important layout-related html. We should standardize dates across wp.org but since this is used specifically for in-content dates, we can leave it as is for now. We don't have good enough context for abstraction. I'll close this until a later date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Format] Time Related to the Time format
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants