In our comment feeds we use the CommentHeader component to display comment information. This includes the date the comment was created or updated. We show the date using toLocaleString(). This causes a hydration error when the server and browser have different time zones.
We want to prevent this hydration error from occurring while still ensuring we show the datetime string in the users' own time zone.
In our comment feeds we use the
CommentHeader
component to display comment information. This includes the date the comment was created or updated. We show the date usingtoLocaleString()
. This causes a hydration error when the server and browser have different time zones.We want to prevent this hydration error from occurring while still ensuring we show the datetime string in the users' own time zone.