facebook / facebook/docusaurus

Update date format to user local format

Offen
#7,249 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
domain: theme feature
Vorherrschende Sprache
TypeScript
Sterne
66.2k
Forks
10k
Ø Merge
1 T. 3 Std.
Gemergte PRs (30 T.)
52

Beschreibung

### Have you read the Contributing Guidelines on issues?

- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#reporting-new-issues).

### Prerequisites

- [X] I'm using the latest version of Docusaurus.
- [ ] I have tried the `npm run clear` or `yarn clear` command.
- [ ] I have tried `rm -rf node_modules yarn.lock package-lock.json` and re-installing packages.
- [ ] I have tried creating a repro with https://new.docusaurus.io.
- [ ] I have read the console error message carefully (if applicable).

### Description

Doc pages have e.g. `Last updated on 4/25/2022 by Simen Bekkhus`, which is the US locale. This makes the date ambiguous when the date is 1-12. While that would still be the case if the date uses the local locale, at least I'd read it correctly 😅

### Reproducible demo

https://github.com/facebook/jest

### Steps to reproduce

Look at the bottom of e.g. https://jestjs.io/docs/jest-object#fake-timers

### Expected behavior

For non-US locales, that it says `Last updated on 25/04/2022 by Simen Bekkhus`, like `new Intl.DateTimeFormat().format()` returns when I run it in the Chrome console. I.e. uses local locale, not US locale.

### Actual behavior

It uses US date formatting.

### Your environment

- Public source code:
- Public site URL: https://jestjs.io/
- Docusaurus version used: `2.0.0-beta.18`
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome 100 (and whatever version of node Netlify uses)
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS 12.13.1

### Self-service

- [ ] I'd be willing to fix this bug myself.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.