UNPKG

@mantine/dates

Version:

Calendars, date and time pickers based on Mantine components

1 lines 920 B
{"version":3,"file":"clamp-time.cjs","names":["timeToSeconds","secondsToTime"],"sources":["../../../../../src/components/TimePicker/utils/clamp-time/clamp-time.ts"],"sourcesContent":["import { secondsToTime, timeToSeconds } from '../time-to-seconds/time-to-seconds';\n\nexport function clampTime(time: string, min: string | undefined, max: string | undefined) {\n const timeInSeconds = timeToSeconds(time);\n const minInSeconds = min ? timeToSeconds(min) : -Infinity;\n const maxInSeconds = max ? timeToSeconds(max) : Infinity;\n\n const clampedSeconds = Math.max(minInSeconds, Math.min(timeInSeconds, maxInSeconds));\n return secondsToTime(clampedSeconds);\n}\n"],"mappings":";;;AAEA,SAAgB,UAAU,MAAc,KAAyB,KAAyB;CACxF,MAAM,gBAAgBA,wBAAAA,cAAc,IAAI;CACxC,MAAM,eAAe,MAAMA,wBAAAA,cAAc,GAAG,IAAI;CAChD,MAAM,eAAe,MAAMA,wBAAAA,cAAc,GAAG,IAAI;CAGhD,OAAOC,wBAAAA,cADgB,KAAK,IAAI,cAAc,KAAK,IAAI,eAAe,YAAY,CAChD,CAAC;AACrC"}