UNPKG

vremel

Version:

JavaScript date utility library for Temporal API

21 lines 651 B
import { isZonedDateTime } from "../type-utils.js"; import { startOfTimeForZonedDateTime } from "./_startOfTimeForZonedDateTime.js"; /** * Returns the start of a hour for the given datetime * @param dt datetime object which includes time info * @returns Temporal object which represents the start of a hour */ export function startOfHour(dt) { const withArg = { minute: 0, second: 0, millisecond: 0, microsecond: 0, nanosecond: 0, }; if (!isZonedDateTime(dt)) { return dt.with(withArg); } return startOfTimeForZonedDateTime(dt, withArg); } //# sourceMappingURL=startOfHour.js.map