Dev Helpers
← Back

Regional date heading

Place this file at app/[lang]/page.tsx in an App Router project.

Open this example in the interactive library

Source code

// app/[lang]/page.tsx

export default async function RegionalDateHeading({
  params,
}: {
  params: Promise<{ lang: string }>;
}) {
  const { lang } = await params;
  const locale = lang === "fr" ? "fr-CA" : "en-CA";
  return (
    <h1>
      <time dateTime="2027-03-10">
        {new Intl.DateTimeFormat(locale, { dateStyle: "full", timeZone: "UTC" }).format(
          new Date("2027-03-10T12:00:00Z"),
        )}
      </time>
    </h1>
  );
}