next.js icon indicating copy to clipboard operation
next.js copied to clipboard

feat(lint): warn about potential `Date` hydration errors

Open balazsorban44 opened this issue 3 years ago • 0 comments

Rendering Date might lead to hydration errors since the server and client can be in different time zones.

This rule should warn about common use cases and give a recommendation on how to solve this.

Example: image

Ref: #37489 React is also working on better errors https://github.com/facebook/react/pull/24250, but this case will likely not be caught as Date errors happen mostly in production due to the time zone difference.

Bug

  • [ ] Related issues linked using fixes #number
  • [ ] Integration tests added
  • [ ] Errors have helpful link attached, see contributing.md

Feature

  • [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • [ ] Related issues linked using fixes #number
  • [ ] Integration tests added
  • [ ] Documentation added
  • [ ] Telemetry added. In case of a feature if it's used or not.
  • [ ] Errors have helpful link attached, see contributing.md

Documentation / Examples

  • [ ] Make sure the linting passes by running pnpm lint
  • [ ] The examples guidelines are followed from our contributing doc

balazsorban44 avatar Aug 09 '22 12:08 balazsorban44