Open this example in the interactive library
Live preview
Source code
// components/BusinessDayWalker.tsx
export default function BusinessDayWalker({
day = "2028-02-29",
}: { day?: string } = {}) {
const d = new Date(day + "T00:00Z");
do {
d.setUTCDate(d.getUTCDate() + 1);
} while ([0, 6].includes(d.getUTCDay()));
return <p>Next weekday: {d.toISOString().slice(0, 10)}</p>;
}
