-
Notifications
You must be signed in to change notification settings - Fork 370
fix(Timestamp): updated logic for rendering datetime attribute #8205
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
Merged
tlabaj
merged 5 commits into
patternfly:main
from
thatblindgeye:iss7952_timestamp_datetime
Oct 24, 2022
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
49bdc62
fix(Timestamp): updated logic for rendering datetime attribute
ee6e222
Updated spread props to prevent duplicate datetime attribute
382b210
Made updates per PR feedback
587fb8e
Added new utils file to helpers index
fadaffc
Removed timezone from dates in tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* @param {Date} date - A date to check the validity of | ||
*/ | ||
export const isValidDate = (date: Date) => Boolean(date && !isNaN(date as any)); |
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
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.
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.
Is the user timezone going to affect these tests? @gitdallas, is there a way we can easily recognize the sorts of tests you had issues with before?
Uh oh!
There was an error while loading. Please reload this page.
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.
the test that fails for me without TZ=EST is "Renders with only date when dateFormat is passed in"

I think it is only happening when a timezone is provided (like EST in the above case) where it finds the user's time relative to that. That test will also pass for me if I use
01:00:00
for time, but not00:59:59
(I'm 1 hour behind EST).You could try it yourself by substituting '1 Jan 2022 00:00:00 EST' with '1 Jan 2022 23:59:00 PST'... it should show January 2nd.
In regard to new test in this PR - it does not have a TZ mentioned so it shouldn't have an issue in any case.
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.
I believe I had formatted the passed in string for those few tests due to the wonkiness that was occurring when running the tests (the tests would pass locally but fail when ran on Github).
I could update those few tests so that instead of
new Date('...EST')
the format is similar to other tests, e.g.new Date(2022, 0, 1)
. @gitdallas do you feel that would be a viable option?