@mantine/dates
Version:
Calendars, date and time pickers based on Mantine components
13 lines (12 loc) • 555 B
JavaScript
"use client";
import { secondsToTime, timeToSeconds } from "../time-to-seconds/time-to-seconds.mjs";
//#region packages/@mantine/dates/src/components/TimePicker/utils/clamp-time/clamp-time.ts
function clampTime(time, min, max) {
const timeInSeconds = timeToSeconds(time);
const minInSeconds = min ? timeToSeconds(min) : -Infinity;
const maxInSeconds = max ? timeToSeconds(max) : Infinity;
return secondsToTime(Math.max(minInSeconds, Math.min(timeInSeconds, maxInSeconds)));
}
//#endregion
export { clampTime };
//# sourceMappingURL=clamp-time.mjs.map