@oslokommune/punkt-elements
Version:
Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo
21 lines (20 loc) • 812 B
TypeScript
/**
* Shared timepicker stepper logic.
* Used by both Elements and React implementations.
* Only framework-agnostic functions belong here.
*/
/**
* Increments or decrements the time by one minute-step.
* Rolls over: incrementing past 23:59 wraps to 00:00, and decrementing past 00:00 wraps to 23:59.
* Falls back to sensible defaults when hours/minutes are empty strings.
*
* @param hours - Current hours display value ('09', '', etc.)
* @param minutes - Current minutes display value ('30', '', etc.)
* @param direction - 1 for next, -1 for previous
* @param minuteStep - Step size in minutes
* @returns Zero-padded { hours, minutes } strings
*/
export declare const stepTime: (hours: string, minutes: string, direction: 1 | -1, minuteStep: number) => {
hours: string;
minutes: string;
};