Skip to content

Conversation

@matthew-white
Copy link
Member

See the commit message for notes. It's a funny issue!

At least on my machine, new Date().toISOString() returns an ISO string
in UTC. During certain hours of the day, the date in UTC is different
from the date in my time zone. That's normally no issue for the DateTime
component, which formats date/times in the user's time zone. However,
because the test removes the time part from the ISO string, the string
becomes a date from tomorrow. The test fails because the <time> element
shows "tomorrow", not "today". I don't think we actually need to remove
the time part for the test to work. When I stop removing the time part,
the test passes throughout the day.
@matthew-white
Copy link
Member Author

Another way to solve this would be to mock the time zone:

setLuxon({ defaultZoneName: 'UTC' });

Then Luxon will act as if the machine is in UTC, causing the UTC date and the date in the local time zone to match.

You could also check the iso prop of the DateTime component rather than the text of the <time> element. That's usually what I end up doing.

Copy link
Contributor

@sadiqkhoja sadiqkhoja left a comment

Choose a reason for hiding this comment

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

it was failing for me earlier, it's working now. I must have been doing something wrong.

@matthew-white matthew-white merged commit 4de6d5c into master Jan 25, 2023
@matthew-white matthew-white deleted the dataset-row-test branch January 25, 2023 23:31
sadiqkhoja added a commit to sadiqkhoja/central-frontend that referenced this pull request Dec 31, 2024
sadiqkhoja added a commit to sadiqkhoja/central-frontend that referenced this pull request Dec 31, 2024
sadiqkhoja added a commit to sadiqkhoja/central-frontend that referenced this pull request Jan 6, 2025
sadiqkhoja added a commit that referenced this pull request Jan 30, 2025
* Feature #710: View deleted Entities and restore Entities

* Show delete retore events in Entity feed

* incorporate PR feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants