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

Fix date rendering by adding <gitea-absolute-date> #29725

Merged
merged 17 commits into from Mar 12, 2024

Conversation

silverwind
Copy link
Member

@silverwind silverwind commented Mar 11, 2024

Alternative to: #29698
Fixes: #29034

image

It also fixes a secondary issue that we were showing timestamp tooltips over date, which makes no sense, so these are now gone as well:

image

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 11, 2024
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 11, 2024
@silverwind
Copy link
Member Author

This is using the current naming scheme, not the one from #29400. Likely in that PR or separately, I will do the rename.

@@ -0,0 +1,40 @@
window.customElements.define('gitea-locale-date', class extends HTMLElement {
Copy link
Member

Choose a reason for hiding this comment

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

why not extend <relative-time>?

Copy link
Member Author

Choose a reason for hiding this comment

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

We aren't replacing https://github.com/github/relative-time-element, we are just adding another custom element to render absolute dates in locale format.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, and to answer specifically: <relative-time> is not meant to be passed dates, only datetimes. So it's currently unsuitable for the date rendering and I'm not sure whether upstream would accept a date parameter as it would increase internal complexity of the component a lot.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 12, 2024
@yardenshoham
Copy link
Member

Backport?

@denyskon
Copy link
Member

We can try....

@denyskon denyskon added the backport/v1.21 This PR should be backported to Gitea 1.21 label Mar 12, 2024
@silverwind
Copy link
Member Author

Backport?

Yeah, would be good.

@silverwind
Copy link
Member Author

I'm open to renaming as well. <gitea-absolute-date> is also a good candidate imho. The gitea- prefix will go away in a future PR when I rename these web components. It's currently only to fit the existing components.

@silverwind silverwind changed the title Fix date rendering by adding <gitea-locale-date> Fix date rendering by adding <gitea-absolute-date> Mar 12, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 12, 2024
@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 12, 2024
@silverwind silverwind enabled auto-merge (squash) March 12, 2024 21:33
@silverwind
Copy link
Member Author

Let's see if it backports automatically 😆.

@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/js labels Mar 12, 2024
@silverwind silverwind merged commit 857243b into go-gitea:main Mar 12, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone Mar 12, 2024
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Mar 12, 2024
Alternative to: go-gitea#29698
Fixes: go-gitea#29034

<img width="278" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/12ecd967-2723-410d-8a28-a1b0f41b7bba">

It also fixes a secondary issue that we were showing timestamp tooltips
over date, which makes no sense, so these are now gone as well:

<img width="284" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/a70432f3-97b6-41e6-b202-b53b76924a66">
@GiteaBot GiteaBot added backport/done All backports for this PR have been created and removed reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. labels Mar 12, 2024
@silverwind silverwind deleted the locale-date branch March 12, 2024 22:39
silverwind added a commit that referenced this pull request Mar 13, 2024
Backport #29725 by @silverwind

Alternative to: #29698
Fixes: #29034

<img width="278" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/12ecd967-2723-410d-8a28-a1b0f41b7bba">

It also fixes a secondary issue that we were showing timestamp tooltips
over date, which makes no sense, so these are now gone as well:

<img width="284" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/a70432f3-97b6-41e6-b202-b53b76924a66">

Co-authored-by: silverwind <me@silverwind.io>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 13, 2024
* giteaofficial/main:
  Fix date rendering by adding `<gitea-absolute-date>` (go-gitea#29725)
  Update to labeler v5 (go-gitea#29721)
  Update Chroma to v2.13.0 (go-gitea#29732)
  Highlight archived labels (go-gitea#29680)
@lunny lunny modified the milestones: 1.23.0, 1.22.0 Mar 13, 2024
@yardenshoham
Copy link
Member

It broke my timezone (UTC+2) if I set March 29
bug

@silverwind
Copy link
Member Author

silverwind commented Mar 13, 2024

Hmm, will need to debug this. You sure your branch is up to date?

silverwind added a commit to silverwind/gitea that referenced this pull request Mar 13, 2024
* main:
  fix missed RenderLabel change in card template (go-gitea#29772)
  Fix incorrect locale Tr for gpg command (go-gitea#29754)
  Improve a11y document and dropdown item (go-gitea#29753)
  Improve QueryEscape helper function (go-gitea#29768)
  Use relative links for commits, mentions, and issues in markdown (go-gitea#29427)
  Move fork router functions to a standalone file (go-gitea#29756)
  Configure pinned JS dependencies via updates.config.js (go-gitea#29696)
  Refactor to use optional.Option for issue index search option (go-gitea#29739)
  Fix user router possbile panic (go-gitea#29751)
  Refactor label.IsArchived() (go-gitea#29750)
  Fix date rendering by adding `<gitea-absolute-date>` (go-gitea#29725)
  Update to labeler v5 (go-gitea#29721)
  Update Chroma to v2.13.0 (go-gitea#29732)
@silverwind
Copy link
Member Author

silverwind commented Mar 15, 2024

@yardenshoham try #29804. Note, I'm not convinced the old implementation had bugs but this new one surely won't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/done All backports for this PR have been created backport/v1.21 This PR should be backported to Gitea 1.21 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code modifies/js modifies/templates This PR modifies the template files size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MIlestones with 2/29 due date display as 2/28
5 participants