Dev Helpers
← Back

UTC date label

Import and render <UTCDateLabel /> in a React project.

Open this example in the interactive library

Live preview

Source code

// components/UTCDateLabel.tsx

export default function UTCDateLabel({
  iso = "2027-03-14T15:30:00Z",
}: { iso?: string } = {}) {
  return (
    <time dateTime={iso}>
      {new Date(iso).toLocaleDateString("en-CA", {
        timeZone: "UTC",
        dateStyle: "long",
      })}
    </time>
  );
}