0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-29 14:56:20 +01:00
gitea/web_src/js/features
Yarden Shoham 6a6dc97b0f
Respect user's locale when rendering the date range in the repo activity page (#21410)
# Description
Previously, to make the date range understood by all, we used the format
"2006-01-02" for the dates as it's locale-generic.

This commit changes the rendering logic. Instead of rendering the date
on the server, we send a formatted computer-readable timestamp. The
client's javascript then renders it according to the user's locale.

This approach is reusable across the codebase, any `<time></time>` tag
with the data-format="date" attribute would get rendered according to
the user's chosen locale.

## Previous View

![image](https://user-images.githubusercontent.com/20454870/195099143-e1c5df86-282a-42f1-898f-a36bb5fe7c2f.png)

## New View

### English

![image](https://user-images.githubusercontent.com/20454870/195099301-5cda4eab-4012-49d5-97e5-b1f9cada9c06.png)

### French

![image](https://user-images.githubusercontent.com/20454870/195099434-ce23e394-8d65-4c4c-8ac8-8b96bc9044f3.png)

### Portuguese

![image](https://user-images.githubusercontent.com/20454870/195099559-9a7aed28-944a-45ec-bedb-64403e3faede.png)

### Italian

![image](https://user-images.githubusercontent.com/20454870/195099661-17758d55-3fe0-4797-879b-d45de0ee8ba3.png)

# References
* #21380 
* #21387
* #21396

Inspiration:

I think either differentiating by class, or probably better by a custom
attribute such as `data-format` or similar, is the best course of
action.

_Originally posted by @delvh in
https://github.com/go-gitea/gitea/issues/21396#issuecomment-1274424788_
      


Resolves #21380

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2022-10-13 00:14:14 +03:00
..
comp Add down key check has tribute container (#21016) 2022-09-03 10:43:27 +01:00
admin-common.js
admin-emails.js
admin-users.js
aria.js
aria.md
clipboard.js
codeeditor.js
colorpicker.js
common-global.js
common-issue.js
common-organization.js
contextpopup.js Refactor from Vue2 to Vue3 (#20044) 2022-10-01 22:26:38 +08:00
dropzone.js
emoji.js
eventsource.sharedworker.js
file-fold.js
formatting.js Respect user's locale when rendering the date range in the repo activity page (#21410) 2022-10-13 00:14:14 +03:00
heatmap.js Refactor from Vue2 to Vue3 (#20044) 2022-10-01 22:26:38 +08:00
imagediff.js
install.js
mcaptcha.js
notification.js Enable contenthash in filename for dynamic assets (#20813) 2022-08-23 20:58:04 +08:00
org-team.js
pull-view-file.js
repo-branch.js
repo-code.js
repo-commit.js Improve commit status icons (#21124) 2022-09-09 17:03:18 -04:00
repo-common.js
repo-diff-filetree.js Refactor from Vue2 to Vue3 (#20044) 2022-10-01 22:26:38 +08:00
repo-diff.js Add filetree on left of diff view (#21012) 2022-09-27 13:22:19 +08:00
repo-editor.js
repo-findfile.js Use weighted algorithm for string matching when finding files in repo (#21370) 2022-10-08 12:22:44 +01:00
repo-findfile.test.js Use weighted algorithm for string matching when finding files in repo (#21370) 2022-10-08 12:22:44 +01:00
repo-graph.js
repo-home.js
repo-issue-content.js
repo-issue-pr-form.js Refactor from Vue2 to Vue3 (#20044) 2022-10-01 22:26:38 +08:00
repo-issue.js
repo-legacy.js Support Issue forms and PR forms (#20987) 2022-09-02 15:58:49 +08:00
repo-migrate.js
repo-migration.js
repo-projects.js
repo-release.js
repo-settings.js
repo-template.js
repo-unicode-escape.js
repo-wiki.js
serviceworker.js Enable contenthash in filename for dynamic assets (#20813) 2022-08-23 20:58:04 +08:00
sshkey-helper.js
stopwatch.js Update JS dependencies and eslint config (#21388) 2022-10-10 20:02:20 +08:00
tablesort.js
tribute.js
user-auth-webauthn.js
user-auth.js
user-settings.js