MCPcopy Create free account
hub / github.com/adobe/react-spectrum / constrainTime

Function constrainTime

packages/@internationalized/date/src/manipulation.ts:251–256  ·  view source on GitHub ↗
(time: Mutable<AnyTime>)

Source from the content-addressed store, hash-verified

249}
250
251export function constrainTime(time: Mutable<AnyTime>): void {
252 time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));
253 time.second = Math.max(0, Math.min(time.second, 59));
254 time.minute = Math.max(0, Math.min(time.minute, 59));
255 time.hour = Math.max(0, Math.min(time.hour, 23));
256}
257
258function nonNegativeMod(a: number, b: number) {
259 let result = a % b;

Callers 2

constructorMethod · 0.90
setTimeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected