Skip to content

fix(web): use locale-aware date formatting for contribution calendar tooltips - #38398

Merged
bircni merged 3 commits into
go-gitea:mainfrom
SudhanshuMatrix:fix/heatmap-locale-date-mismatch
Jul 10, 2026
Merged

fix(web): use locale-aware date formatting for contribution calendar tooltips#38398
bircni merged 3 commits into
go-gitea:mainfrom
SudhanshuMatrix:fix/heatmap-locale-date-mismatch

Conversation

@SudhanshuMatrix

@SudhanshuMatrix SudhanshuMatrix commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

The contribution calendar manually constructed localized date strings instead of using the browser's locale-aware date formatting. Replace this with toLocaleDateString() to correctly format dates for all locales and calendar systems, including non-Gregorian calendars.

Fixes #38375

Before and After Comparison (Persian fa-IR)

Before (Buggy)

image

After (Fixed)
image

…tooltips

Fixes a logical bug where the heatmap tooltips format dates using a
hardcoded Gregorian layout combined with translated month names, producing
invalid/mixed dates (such as "تیر 9, 2026" instead of "18 Tir 1405" under
the Persian/fa-IR locale). This change resolves the issue by formatting
the tooltips via browser-native `toLocaleDateString` using the user's active locale.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 10, 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 Jul 10, 2026
@bircni
bircni requested a review from silverwind July 10, 2026 17:07
@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 Jul 10, 2026
@bircni bircni added the backport/v1.27 This PR should be backported to Gitea 1.27 label Jul 10, 2026
@bircni
bircni enabled auto-merge (squash) July 10, 2026 18:32
@bircni bircni added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jul 10, 2026
@bircni bircni added this to the 28.0.0 milestone Jul 10, 2026
@bircni
bircni merged commit c12e92c into go-gitea:main Jul 10, 2026
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jul 10, 2026
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Jul 10, 2026
bircni pushed a commit that referenced this pull request Jul 10, 2026
…tooltips (#38398) (#38401)

Backport #38398 by @SudhanshuMatrix

The contribution calendar manually constructed localized date strings
instead of using the browser's locale-aware date formatting. Replace
this with `toLocaleDateString()` to correctly format dates for all
locales and calendar systems, including non-Gregorian calendars.

Fixes #38375
---

### Before and After Comparison (Persian `fa-IR`)

Before (Buggy) 
 
<img width="1246" height="651" alt="image"
src="https://github.com/user-attachments/assets/670698e6-dd4a-4c7e-b7fb-23849090d1b9"
/>
 
After (Fixed) 
<img width="1246" height="651" alt="image"
src="https://github.com/user-attachments/assets/9b65c647-876e-475b-98d1-614ef316fd6f"
/>

Co-authored-by: Shudhanshu Singh <sudhanshuwriterblc@gmail.com>
@SudhanshuMatrix
SudhanshuMatrix deleted the fix/heatmap-locale-date-mismatch branch July 11, 2026 04:45
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jul 13, 2026
* 'main' of https://github.com/go-gitea/gitea:
  fix: various security fixes (go-gitea#38406)
  fix(util): reject invalid characters between time-estimate units (go-gitea#38416)
  feat(actions): implement adaptive auto-refresh for workflow runs list (go-gitea#38329)
  fix(turnstile): route CAPTCHA verification through the configured proxy (go-gitea#38412)
  fix: represent a deleted assignee team as a Ghost team (go-gitea#38413)
  [skip ci] Updated translations via Crowdin
  fix: refresh pull request merge box when the commit status is pending (go-gitea#38410)
  chore: remove Yarden Shoham from maintainers (go-gitea#38407)
  fix: actions task state concurrent update (go-gitea#38405)
  fix(actions): keep workflow run trailing on one row with long branch names (go-gitea#38382)
  fix(pull): re-evaluate review official flag on target branch change (go-gitea#38319)
  fix(web): use locale-aware date formatting for contribution calendar tooltips (go-gitea#38398)
  fix(security): harden access checks and migration validation (go-gitea#38324)
  fix: enforce public-only token scope and harden push options / locale parsing (go-gitea#38323)
  fix: co-author detection (go-gitea#38392)
  fix(api): stop leaking private repo metadata after access revocation (go-gitea#38321)
  fix(lfs): require proof of possession for cross-repo objects (go-gitea#38322)
  fix: incorrect co-author detection on commit page (go-gitea#38386)
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jul 13, 2026
* main:
  fix: various security fixes (go-gitea#38406)
  fix(util): reject invalid characters between time-estimate units (go-gitea#38416)
  feat(actions): implement adaptive auto-refresh for workflow runs list (go-gitea#38329)
  fix(turnstile): route CAPTCHA verification through the configured proxy (go-gitea#38412)
  fix: represent a deleted assignee team as a Ghost team (go-gitea#38413)
  [skip ci] Updated translations via Crowdin
  fix: refresh pull request merge box when the commit status is pending (go-gitea#38410)
  chore: remove Yarden Shoham from maintainers (go-gitea#38407)
  fix: actions task state concurrent update (go-gitea#38405)
  fix(actions): keep workflow run trailing on one row with long branch names (go-gitea#38382)
  fix(pull): re-evaluate review official flag on target branch change (go-gitea#38319)
  fix(web): use locale-aware date formatting for contribution calendar tooltips (go-gitea#38398)
  fix(security): harden access checks and migration validation (go-gitea#38324)
  fix: enforce public-only token scope and harden push options / locale parsing (go-gitea#38323)
  fix: co-author detection (go-gitea#38392)
  fix(api): stop leaking private repo metadata after access revocation (go-gitea#38321)
  fix(lfs): require proof of possession for cross-repo objects (go-gitea#38322)
  fix: incorrect co-author detection on commit page (go-gitea#38386)
zeekay pushed a commit to hanzoai/git that referenced this pull request Jul 26, 2026
…tooltips (go-gitea#38398)

The contribution calendar manually constructed localized date strings
instead of using the browser's locale-aware date formatting. Replace
this with `toLocaleDateString()` to correctly format dates for all
locales and calendar systems, including non-Gregorian calendars.

Fixes go-gitea#38375
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.27 This PR should be backported to Gitea 1.27 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persian locale on contribution calendar shows mixed Gregorian and Jalali dates

4 participants