vremel
Version:
JavaScript date utility library for Temporal API
19 lines • 554 B
JavaScript
import { isZonedDateTime } from "../type-utils.js";
/**
* Returns the start of a day for the given datetime
* @param dt datetime object which includes date and time info
* @returns Temporal object which represents the start of a day
*/
export function startOfDay(dt) {
return (isZonedDateTime(dt) ?
dt.startOfDay()
: dt.with({
hour: 0,
minute: 0,
second: 0,
millisecond: 0,
microsecond: 0,
nanosecond: 0,
}));
}
//# sourceMappingURL=startOfDay.js.map