@theholocron/date-time-utils
v1.2.4
Published
Handle dates and time.
Downloads
1,043
Readme
@theholocron/date-time-utils
Date and time utilities.
Installation
pnpm add @theholocron/date-time-utilsUsage
import { getTimeOfDay } from "@theholocron/date-time-utils";
getTimeOfDay(); // uses current time
getTimeOfDay(new Date("2024-01-01 08:00")); // "morning"
getTimeOfDay(new Date("2024-01-01 14:00")); // "afternoon"
getTimeOfDay(new Date("2024-01-01 20:00")); // "evening"getTimeOfDay(date?)
Returns "morning" (midnight–10:59), "afternoon" (11:00–17:59), or "evening" (18:00+). Defaults to the current time when no date is passed.
Documentation
Check out The Holocron Archive for more information.
