Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
`temporal-polyfill` `Temporal.Instant.from` flagged with "used `new Date()` before accessing either uncached data" | GoodFirstPicks

`temporal-polyfill` `Temporal.Instant.from` flagged with "used `new Date()` before accessing either uncached data"

vercel/next.js 8 comments 22d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeNext.jsTypeScriptReact

Why this is a good first issue

Issue involves modifying or allowing a polyfill's internal Date usage in Next.js.

AI Summary

The issue arises because `Temporal.Instant.from` internally uses `new Date()`, triggering Next.js's uncached data access error. The solution likely involves modifying the polyfill or Next.js to handle this case, but depends on external polyfill maintenance.

Issue Description

Link to the code that reproduces this issue

https://github.com/rikbrown/nextjs-temporal-polyfill-cache-components-issue

To Reproduce

  1. Start the provided application in next dev
  2. Visit http://localhost:3000/from-iso
  3. Observe cache components error

Current vs. Expected behavior

Basically, Temporal.Instant.from(<iso>) polyfilled via temporal-polyfill is throwing the uncached data error. This isn't expected: this is used to create an instant from a fixed point of time which should be safe in cached environments.

This does not reproduce:

  1. creating via new Date(<iso>).toTemporalInstant() -- this is the workaround for now in production
  2. creating via Temporal.Instant.from(<epoch ms>)

I think Temporal.Instant.from(<iso>) is internally creating a new Date() somewhere, which is causing it to be flagged by Next.js. I suspect it is doing it to assign fields to the date, not to actually use anything about the current date, but haven't been able to go deep in their code yet (will update ticket soon). See comment below for the culprit code.

With Temporal starting to be released in browsers, it's likely many more people will reach for a polyfill so they can use it, and this is the most popular (or one of two most popuar) polyfills. Is there a way to allowlist this path so it is not considered uncached data access?


Current:

Error: Route "/from-iso" used `new Date()` before accessing either uncached data (e.g. `fetch()`) or Request data (e.g. `cookies()`, `headers()`, `connection()`, and `searchParams`). Accessing the current time in a Server Component requires reading one of these data sources first. Alternatively, consider moving this expression into a Client Component or Cache Component. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time
    at Home (page.tsx:4:35)
    at Home (<anonymous>:1:13)

Expected: no error

Provide

GitHub Labels

Cache Components

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • dependency on external polyfill
  • potential cross-cutting changes
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno