How to fix non iso date on Next.js (Headless)

Change every datePublished (and dateModified) value in your structured data from a human-readable string to a strict ISO-8601 date — formatted as YYYY-MM-DD or YYYY-MM-DDThh:mm:ss+hh:mm — so search engines can reliably parse your content's freshness.

Steps for Next.js (Headless)

  1. Locate every page or component that renders a JSON-LD <Script type='application/ld+json'> block (typically in app/[slug]/page.tsx, app/blog/[slug]/page.tsx, or a shared JsonLd component).
  2. Create a shared helper utility (e.g. lib/formatIsoDate.ts) that accepts any date value and always returns a strict ISO-8601 string with timezone offset (YYYY-MM-DDThh:mm:ss+hh:mm), throwing a clear error for invalid inputs so bad dates are caught at build time.
  3. Replace every raw date string literal or .toLocaleDateString() / human-readable format passed to datePublished and dateModified with a call to this helper — both in the JSON-LD structured-data object AND in any og:article:published_time / og:article:modified_time meta tags produced by generateMetadata().
  4. For dates that originate from a CMS or API, pipe the raw value (ISO string, Unix timestamp, or JS Date object) directly into the helper rather than formatting it for display first — keep display formatting separate (e.g. use Intl.DateTimeFormat only for visible UI text).
  5. Run next build and check the build output for any thrown date-format errors from the helper; then validate a rendered page's JSON-LD with Google's Rich Results Test to confirm the ISO-8601 format is accepted.
Official Next.js (Headless) documentation ↗

What is non iso date?

Structured data on your pages (the hidden JSON-LD code that tells Google and other search engines what your content is about) includes date fields such as `datePublished` and `dateModified`. ISO-8601 is the internationally standardised date format — for example, `2025-03-12` or `2025-03-12T09:00:00+00:00`. When a date is written in plain English instead — like "Wed Mar 12 2025" — machines can't reliably read it, because there's no single agreed way to parse natural-language dates. Your current schema contains at least one date in a non-standard format, which means search engines may misread or completely ignore it.

Content freshness is a real ranking signal. Google uses `datePublished` and `dateModified` to understand when your pages and articles were created or last updated, and it surfaces that information directly in search results (e.g., "3 days ago" next to a result). If the date can't be parsed, Google may either ignore freshness entirely — hurting rankings for time-sensitive queries — or infer an incorrect date, making a new page look old. For AEO (Answer Engine Optimisation), where AI-powered tools like Google's AI Overviews and Bing Copilot prioritise the freshest, most reliable sources, an unreadable date can mean your content is skipped over in favour of competitors whose schema is clean. Fixing this is a quick win with direct impact on how your pages are indexed and presented.

See the complete Non iso date guide for every platform and the full background.

Not sure if your Next.js (Headless) store has this?

Run a free SEOLZ scan — we’ll find non iso date and every other issue across your whole site.

Scan my site free

Fix non iso date on another platform