Skip to content

Fix relative-time RangeError#37021

Merged
silverwind merged 5 commits intogo-gitea:mainfrom
silverwind:relerr
Mar 28, 2026
Merged

Fix relative-time RangeError#37021
silverwind merged 5 commits intogo-gitea:mainfrom
silverwind:relerr

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Mar 28, 2026

navigator.language can be undefined in headless browsers (e.g. Playwright Firefox), causing RangeError: invalid language tag: "undefined" in Intl.DateTimeFormat within the relative-time web component.

Also adds an e2e test that verifies relative-time renders correctly and a shared assertNoJsError helper.

Bug is als present in https://github.com/github/relative-time-element but (incorrectly) masked there.

Fixes: #25324

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 28, 2026
@wxiaoguang
Copy link
Copy Markdown
Contributor

It also fixes this: JavaScript error: Uncaught RangeError: Incorrect locale information provided #25324

@silverwind silverwind force-pushed the relerr branch 3 times, most recently from 398ae9c to f78cc47 Compare March 28, 2026 10:42
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Mar 28, 2026
Add 'en' fallback for navigator.language which can be undefined in
headless browsers (e.g. Playwright Firefox), causing RangeError in
Intl.DateTimeFormat. Add e2e test and shared assertNoJsError helper.

Co-Authored-By: Claude (Opus 4.6) <[email protected]>
@github-actions github-actions bot added the modifies/templates This PR modifies the template files label Mar 28, 2026
@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 28, 2026
@silverwind
Copy link
Copy Markdown
Member Author

Looks good. This new assertNoJsError could be used in a lot more tests later, it's universally useful. Not doing it in this PR though, keeping it focused.

@silverwind silverwind changed the title Fix relative-time RangeError in headless browsers Fix relative-time RangeError Mar 28, 2026
@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 28, 2026
@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 28, 2026
@silverwind silverwind enabled auto-merge (squash) March 28, 2026 12:33
@silverwind silverwind merged commit 7492251 into go-gitea:main Mar 28, 2026
26 checks passed
@silverwind silverwind deleted the relerr branch March 28, 2026 13:10
@GiteaBot GiteaBot added this to the 1.26.0 milestone Mar 28, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 28, 2026
silverwind added a commit to silverwind/gitea that referenced this pull request Mar 28, 2026
* origin/main:
  Fix relative-time RangeError (go-gitea#37021)
  Restyle Workflow Graph (go-gitea#36912)
  Update message severity colors, fix navbar double border (go-gitea#37019)
  Clean up checkbox cursor styles (go-gitea#37016)
  add missing cron tasks to example ini (go-gitea#37012)
  Add e2e tests for server push events (go-gitea#36879)
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 30, 2026
* main: (35 commits)
  Correct swagger annotations for enums, status codes, and notification state (go-gitea#37030)
  Update Nix flake (go-gitea#37024)
  Bump go and python versions in nix flake (go-gitea#37031)
  Make task list checkboxes clickable in the preview tab (go-gitea#37010)
  Add support for in_progress event in workflow_run webhook (go-gitea#36979)
  Fix various problems (go-gitea#37029)
  Update AI Contribution Policy (go-gitea#37022)
  Migrate from webpack to vite (go-gitea#37002)
  Upgrade yaml (go-gitea#37015)
  Fix issue label deletion with Actions tokens (go-gitea#37013)
  Hide delete branch or tag buttons in mirror or archived repositories. (go-gitea#37006)
  Update AGENTS.md with additional guidelines (go-gitea#37018)
  Optimize 'refreshAccesses' to perform update without removing then adding (go-gitea#35702)
  Fix relative-time RangeError (go-gitea#37021)
  Restyle Workflow Graph (go-gitea#36912)
  Update message severity colors, fix navbar double border (go-gitea#37019)
  Clean up checkbox cursor styles (go-gitea#37016)
  add missing cron tasks to example ini (go-gitea#37012)
  Add e2e tests for server push events (go-gitea#36879)
  Update JS dependencies (go-gitea#37001)
  ...
silverwind added a commit to silverwind/gitea that referenced this pull request Mar 30, 2026
* origin/main: (69 commits)
  Correct swagger annotations for enums, status codes, and notification state (go-gitea#37030)
  Update Nix flake (go-gitea#37024)
  Bump go and python versions in nix flake (go-gitea#37031)
  Make task list checkboxes clickable in the preview tab (go-gitea#37010)
  Add support for in_progress event in workflow_run webhook (go-gitea#36979)
  Fix various problems (go-gitea#37029)
  Update AI Contribution Policy (go-gitea#37022)
  Migrate from webpack to vite (go-gitea#37002)
  Upgrade yaml (go-gitea#37015)
  Fix issue label deletion with Actions tokens (go-gitea#37013)
  Hide delete branch or tag buttons in mirror or archived repositories. (go-gitea#37006)
  Update AGENTS.md with additional guidelines (go-gitea#37018)
  Optimize 'refreshAccesses' to perform update without removing then adding (go-gitea#35702)
  Fix relative-time RangeError (go-gitea#37021)
  Restyle Workflow Graph (go-gitea#36912)
  Update message severity colors, fix navbar double border (go-gitea#37019)
  Clean up checkbox cursor styles (go-gitea#37016)
  add missing cron tasks to example ini (go-gitea#37012)
  Add e2e tests for server push events (go-gitea#36879)
  Update JS dependencies (go-gitea#37001)
  ...

# Conflicts:
#	package.json
#	pnpm-lock.yaml
#	tests/e2e/utils.ts
#	web_src/css/themes/theme-gitea-dark.css
#	web_src/css/themes/theme-gitea-light.css
#	web_src/js/bootstrap.ts
#	web_src/js/features/codeeditor.ts
#	web_src/js/modules/errors.test.ts
#	webpack.config.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JavaScript error: Uncaught RangeError: Incorrect locale information provided

4 participants