JavaScript months are zero-based, while quarter labels start at one. Derive the quarter from the calendar convention your users expect.
Worked example
// components/QuarterIdentifier.tsx
export default function QuarterIdentifier({
day = "2028-02-29",
}: { day?: string } = {}) {
const d = new Date(day + "T00:00Z");
return (
<time dateTime={day}>
Q{1 + Math.floor(d.getUTCMonth() / 3)} {d.getUTCFullYear()}
</time>
);
}Implementation notes
Fiscal quarters can start in another month. Put the fiscal offset in one function rather than scattering adjustments across components.
Try it yourself
Test March 31 and April 1.
Open the React example →Editorial date August 25, 2025 · Published December 6, 2026