import { Duration } from '@wisemen/quantity'; import { InclusivityString } from '../common/inclusivity.js'; import { DayjsPlainDate } from '../plain-date/dayjs-plain-date.js'; import { Timestamp } from '../timestamp/timestamp.js'; import { TimezoneInput } from '../common/timezone.js'; import { PlainTimeObject } from './plain-time-object.type.js'; export type PlainTimeInput = number | string | PlainTimeImpl | PlainTimeObject | Date | { toDate: () => Date; } | undefined; export type PlainTime = PlainTimeImpl; export declare class PlainTimeImpl { private absoluteMilliseconds; constructor(); constructor(timeString: string); constructor(date: Date); constructor(timeObject: PlainTimeObject); constructor(absoluteMilliSeconds: number); constructor(transformable: { toDate: () => Date; }); constructor(target: PlainTimeInput); toString(): string; toJSON(): string; format(format?: 'hh:mm:ss' | 'hh:mm' | 'hh:mm:ss.SSS'): string; isBefore(other: PlainTimeInput): boolean; isSameOrBefore(other: PlainTimeInput): boolean; isAfter(other: PlainTimeInput): boolean; isSameOrAfter(other: PlainTimeInput): boolean; /** * @param lowerBound must be before or same as upperBound * @param upperBound must be after or same as lowerBound * @throws InvalidBounds */ isBetween(lowerBound: PlainTimeInput, upperBound: PlainTimeInput, inclusivity?: InclusivityString): boolean; isSame(other: PlainTimeInput): boolean; hours(): number; minutes(): number; seconds(): number; milliseconds(): number; /** * Add a duration to this time, wrapping around the clock if necessary. * @example 23:00:00 + 2 hours = 01:00:00 * @example 10:30:00 + 30 minutes = 11:00:00 */ add(duration: Duration): PlainTimeImpl; /** * Subtract a duration from this time, wrapping around the clock if necessary. * @example 01:00:00 - 2 hours = 23:00:00 * @example 10:30:00 - 30 minutes = 10:00:00 */ subtract(duration: Duration): PlainTimeImpl; /** * Get the time that has elapsed since a previous time up until this time as a duration. * The duration represents the wall clock time duration. This means that the duration wraps * around the clock. * @example duration between 02h00 and 03h00 is 1 hour * @example duration between 03h00 and 02h00 is 23 hours */ since(other: PlainTimeInput): Duration; /** * Get the time until a future time as a duration. * The duration represents the wall clock time duration. This means that the duration wraps * around the clock. * @example duration between 02h00 and 03h00 is 1 hour * @example duration between 03h00 and 02h00 is 23 hours */ until(other: PlainTimeInput): Duration; toPlainObject(): PlainTimeObject; copy(): PlainTimeImpl; /** * Compares the order of the given time with this time. \ * returns < 0 if this time is before the given time \ * returns 0 if this time is the same as the given time \ * returns > 0 if this time is after the given time \ * \ * The returned value is the difference in milliseconds between the compared times. */ compare(withOther: PlainTimeInput): number; toTimestamp(withDate: DayjsPlainDate, timeZone: TimezoneInput): Timestamp; private calculateAbsoluteMilliseconds; private validateAbsoluteMilliseconds; }