-
Notifications
You must be signed in to change notification settings - Fork 13
fix(mwpw-169194): sanitizes createdDate format used by the detailsText #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Core Web Vitals Metrics
Recorded at: 2025-03-11T13:10:14.846Z |
Core Web Vitals Metrics
Recorded at: 2025-03-11T17:22:43.108Z |
Core Web Vitals Metrics
Recorded at: 2025-03-11T21:38:00.555Z |
| const localCreatedDate = new Date(cardDate); | ||
| detailText = localCreatedDate.toLocaleDateString(); | ||
| } else if (detailsTextOption === 'staticDate' && cardDate) { | ||
| const staticDate = new Date(cardDate.replace(/Z$/, '')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very clean solution!
Much better than just splitting by T and taking the left hand (as it'll also localize the dates in the right format)
Core Web Vitals Metrics
Recorded at: 2025-03-12T22:58:12.997Z |
Description:
Sanitizes createdDate format when the timestamp is set to 00:00:00.0000Z
Simple and effective implementation that when the timestamp is set to 00:00:00.0000Z removes the 'Z' part of the string before creating the JavaScript object and using the local timezone instead of 'GMT'
Test page:
Content as a Service v3 - Tuesday, March 11, 2025 at 10:15