UNPKG

@mantine/dates

Version:

Calendars, date and time pickers based on Mantine components

23 lines (22 loc) 805 B
"use client"; const require_pad_time = require("../pad-time/pad-time.cjs"); //#region packages/@mantine/dates/src/components/TimePicker/utils/time-to-seconds/time-to-seconds.ts function timeToSeconds(timeStr) { const [hours = 0, minutes = 0, seconds = 0] = timeStr.split(":").map(Number); return hours * 3600 + minutes * 60 + seconds; } function secondsToTime(seconds) { const hours = Math.floor(seconds / 3600); const minutes = Math.floor(seconds % 3600 / 60); const secs = seconds % 60; return { timeString: `${require_pad_time.padTime(hours)}:${require_pad_time.padTime(minutes)}:${require_pad_time.padTime(secs)}`, hours, minutes, seconds: secs }; } //#endregion exports.secondsToTime = secondsToTime; exports.timeToSeconds = timeToSeconds; //# sourceMappingURL=time-to-seconds.cjs.map