vremel
Version:
JavaScript date utility library for Temporal API
20 lines • 640 B
JavaScript
import { isZonedDateTime } from "../type-utils.js";
import { startOfTimeForZonedDateTime } from "./_startOfTimeForZonedDateTime.js";
/**
* Returns the start of a minute for the given datetime
* @param dt datetime object which includes time info
* @returns Temporal object which represents the start of a minute
*/
export function startOfMinute(dt) {
const withArg = {
second: 0,
millisecond: 0,
microsecond: 0,
nanosecond: 0,
};
if (!isZonedDateTime(dt)) {
return dt.with(withArg);
}
return startOfTimeForZonedDateTime(dt, withArg);
}
//# sourceMappingURL=startOfMinute.js.map