@northguild/gmt
Version:
Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.
20 lines • 908 B
TypeScript
import { TimeDurationUnit } from "../../types/time-duration-unit.js";
import "../../types/index.js";
/**
* Return a PlainTime ISO string with `units` added to `value`.
*
* - Validates `value`, `units`, and `amount` before performing the add.
* - Returns "" for invalid inputs.
*
* There is no options argument (its only member, `overflow`, was removed in 1.16.0): Temporal
* `PlainTime#add` takes no options and always wraps around the clock (e.g. 23:00 + 2 hours
* = 01:00).
*
* @param value ISO PlainTime string
* @param units Partial<Record<TimeDurationUnit, number>> object specifying units to add
* @returns ISO PlainTime string after addition, or "" on invalid input
*
* @example addTime("12:00:00", { hours: 1 }) // "13:00:00"
* @example addTime("invalid", { hours: 1 }) // ""
*/
export declare function addTime(value: string, units: Partial<Record<TimeDurationUnit, number>>): string;