Skip to content

getTimeOfDay

getTimeOfDay(date?): TTimeOfDay

Defined in: get-time-of-day.ts:14

The part of the day for date’s local hour (the current time when date is omitted or invalid): "morning" before 11:00, "afternoon" from 11:00 to 17:59, otherwise "evening".

Date

TTimeOfDay

import { getTimeOfDay } from "@theholocron/date-time-utils";
getTimeOfDay(); // e.g. "morning"
getTimeOfDay(new Date("2024-01-01T20:00:00")); // "evening"