refactor(theme): dates should be formatted on the client-side instead of in nodejs code#9868
Merged
refactor(theme): dates should be formatted on the client-side instead of in nodejs code#9868
Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the deploy preview of this PR
|
|
Size Change: 0 B Total Size: 992 kB ℹ️ View Unchanged
|
slorber
requested changes
Feb 20, 2024
Collaborator
There was a problem hiding this comment.
Looks like it's working
However the React code is too duplicated, we need a better abstraction.
Yes existing tests are failing, all the tests/snapshots need to be cleaned up from this removed nodejs attribute 😄
Note: we also have a formatted date in the docs plugin.
I think this refactor is a good opportunity to also migrate this code to the client-side:
formattedLastUpdatedAt: lastUpdate.lastUpdatedAt
? formatDate(
i18n.currentLocale,
new Date(lastUpdate.lastUpdatedAt * 1000),
i18n.localeConfigs[i18n.currentLocale]!.calendar,
)
: undefined,
packages/docusaurus-theme-classic/src/theme/BlogArchivePage/index.tsx
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/BlogArchivePage/index.tsx
Outdated
Show resolved
Hide resolved
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
slorber
requested changes
Feb 22, 2024
packages/docusaurus-plugin-content-blog/src/__tests__/index.test.ts
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/BlogArchivePage/index.tsx
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/BlogPostItem/Header/Info/index.tsx
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/LastUpdated/index.tsx
Outdated
Show resolved
Hide resolved
3 tasks
slorber
requested changes
Feb 23, 2024
packages/docusaurus-plugin-content-blog/src/__tests__/index.test.ts
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/LastUpdated/index.tsx
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/LastUpdated/index.tsx
Outdated
Show resolved
Hide resolved
OzakIOne
added a commit
that referenced
this pull request
Feb 28, 2024
… of in nodejs code (#9868) Co-authored-by: OzakIOne <[email protected]> Co-authored-by: sebastien <[email protected]>
This was referenced Jun 27, 2024
This was referenced Jul 17, 2024
This was referenced Jul 21, 2024
This was referenced Jul 21, 2024
This was referenced Aug 4, 2024
This was referenced Aug 12, 2024
This was referenced Aug 15, 2024
This was referenced Aug 27, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-flight checklist
Motivation
As discussed in #9830 this would allow users to have their own format date by swizzling
However I'm wondering if it is the correct way to do it and I also don't know what to do with the failing tests because the formatted date is no more in node
Test Plan
Unit test
Test links
Deploy preview: https://deploy-preview-9868--docusaurus-2.netlify.app/blog/archive
Related issues/PRs
fix #9830