Skip to content

refactor(v2): format post date using Intl#4344

Merged
slorber merged 4 commits into
masterfrom
lex111/format-post-date-intl
Mar 4, 2021
Merged

refactor(v2): format post date using Intl#4344
slorber merged 4 commits into
masterfrom
lex111/format-post-date-intl

Conversation

@lex111

@lex111 lex111 commented Mar 3, 2021

Copy link
Copy Markdown
Contributor

Motivation

As discussed earlier, we'd better format the date using the Intl API. Since the current minimum version of Node.js does not offer full ICU support, we will use the polyfill Intl, which we will remove when moving to Node v14.

This will not affect on final client bundle size as formatting doing on during prerendering.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Preview.

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@lex111 lex111 added the pr: polish This PR adds a very minor behavior improvement that users will enjoy. label Mar 3, 2021
@lex111 lex111 requested a review from slorber as a code owner March 3, 2021 23:27
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Mar 3, 2021
@netlify

netlify Bot commented Mar 3, 2021

Copy link
Copy Markdown

[V1] Deploy preview success

Built with commit 0ae6adc

https://deploy-preview-4344--docusaurus-1.netlify.app

@netlify

netlify Bot commented Mar 3, 2021

Copy link
Copy Markdown

Deploy preview for docusaurus-2 ready!

Built with commit 0ae6adc

https://deploy-preview-4344--docusaurus-2.netlify.app

@lex111 lex111 force-pushed the lex111/format-post-date-intl branch from 3d49a04 to 3c28e32 Compare March 3, 2021 23:42
@github-actions

github-actions Bot commented Mar 3, 2021

Copy link
Copy Markdown

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟢 Performance 91
🟢 Accessibility 96
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-4344--docusaurus-2.netlify.app/classic/

@github-actions

github-actions Bot commented Mar 3, 2021

Copy link
Copy Markdown

Size Change: -1 B (0%)

Total Size: 532 kB

ℹ️ View Unchanged
Filename Size Change
website/build/assets/css/styles.********.css 87.4 kB 0 B
website/build/assets/js/main.********.js 359 kB 0 B
website/build/blog/2017/12/14/introducing-docusaurus/index.html 60.3 kB -1 B (0%)
website/build/docs/introduction/index.html 235 B 0 B
website/build/index.html 25.4 kB 0 B

compressed-size-action

@lex111 lex111 added this to the v2.0.0-alpha.71 milestone Mar 4, 2021
"fs-extra": "^9.1.0",
"gray-matter": "^4.0.2",
"intl": "^1.2.5",
"intl-locales-supported": "^1.8.12",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, it seems deprecated but seems safe in our case 🤪

formatjs/formatjs#1789

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, didn't know about it, but this is a temporary solution until we set v14 as the minimum version of Node.

@slorber

slorber commented Mar 4, 2021

Copy link
Copy Markdown
Collaborator

Looks great thanks!

@slorber slorber merged commit 1dd400d into master Mar 4, 2021
@slorber slorber deleted the lex111/format-post-date-intl branch August 17, 2021 17:50
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
* refactor(v2): format post date using Intl

* Fix test

* Blog: add localized blog post date test

Co-authored-by: slorber <lorber.sebastien@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: polish This PR adds a very minor behavior improvement that users will enjoy.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants