Codehagen/Dingify

Bug: Hydration Error on Dashboard Page

Closed this issue · 1 comments

Describe the bug

When you refresh the site you can see that we have a hydration error. This is probably the EventDetailsTable component.

Picture under is the error.
Screenshot 2024-05-21

Steps to reproduce

  1. Go to /dashboard
  2. Refresh the page
  3. See error on left corner

Expected Behavior

The page should refresh without any errors.

The reason we are seeing this is due to the format of the date being different from the server and the client side. One way to fix it seems to be using a library like date-fns to format the date according in the EventsDashboardDetails.tsx file.

{format(new Date(event?.createdAt), "P")}

But the above method will format the date according to only a single format globally. If we want to change the region, then we might have to dynamically collect the locale and then convert it to that format I think so..