Scheduled Date
The useScheduledDate hook from the Blotch Library returns the moment your Frame is scheduled to go on display.
import { useScheduledDate } from "~lib/use-scheduled-date";
import { useTimeZone } from "~lib/use-time-zone";
const Widget = () => {
const scheduledDate = useScheduledDate();
const timeZone = useTimeZone();
return (
<h1>
{scheduledDate.toLocaleDateString(undefined, {
timeZone,
weekday: "long",
})}
</h1>
);
};
new Date() already gives you this moment, as Date and Time explains, so you never need the hook. Use it when you want your code to say plainly that it shows the Frame's display time.
In the Widget Designer preview, it gives you the current time.