bench-forgejo/templates
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
..
admin Support instance-wide OAuth2 applications (#21335) 2022-10-12 22:08:29 +08:00
api/packages/pypi Add Package Registry (#16510) 2022-03-30 16:42:47 +08:00
base Removed one extra whitespace in footer after "Template" (#21364) 2022-10-08 11:53:42 +08:00
code Add user/organization code search (#19977) 2022-10-11 00:12:03 +01:00
custom Add footer extra links template (#9576) 2020-01-03 20:41:56 +02:00
explore Add user/organization code search (#19977) 2022-10-11 00:12:03 +01:00
mail Make sure fmt catches all templates (#20979) 2022-08-31 23:58:54 +08:00
org Add user/organization code search (#19977) 2022-10-11 00:12:03 +01:00
package Fix empty container layer history and UI (#21251) 2022-09-27 15:03:24 +02:00
repo Respect user's locale when rendering the date range in the repo activity page (#21410) 2022-10-13 00:14:14 +03:00
shared Do not add links to Posters or Assignees with ID < 0 (#20577) 2022-09-03 10:33:34 +01:00
status Remove fomantic image module (#21145) 2022-09-12 17:08:46 +08:00
swagger Make external issue tracker regexp configurable via API (#21338) 2022-10-07 20:49:30 +08:00
user Support instance-wide OAuth2 applications (#21335) 2022-10-12 22:08:29 +08:00
home.tmpl Refactor i18n to locale (#20153) 2022-06-27 15:58:46 -05:00
install.tmpl Rework mailer settings (#18982) 2022-08-02 13:24:18 +08:00
post-install.tmpl Rename StaticUrlPrefix to AssetUrlPrefix (#15779) 2021-05-08 16:27:25 +02:00