Open this example in the interactive library
Source code
// app/regions/[code]/page.tsx
import { notFound } from "next/navigation";
export default async function RegionalWeekdayNames({
params,
}: {
params: Promise<{ code: string }>;
}) {
const places = [
{
code: "ca",
lang: "en-CA",
currency: "CAD",
zones: ["America/Toronto", "America/Vancouver"],
},
{ code: "jp", lang: "ja-JP", currency: "JPY", zones: ["Asia/Tokyo"] },
];
const { code } = await params;
const place = places.find((p) => p.code === code);
if (!place) notFound();
return (
<ol>
{Array.from({ length: 7 }, (_, i) => (
<li key={i}>
{new Intl.DateTimeFormat(place.lang, {
weekday: "long",
timeZone: "UTC",
}).format(Date.UTC(2028, 0, 3 + i))}
</li>
))}
</ol>
);
}
