UNPKG

@date-vir/duration

Version:

Durations units an utils for date-vir.

102 lines (101 loc) 3.36 kB
import { type Hour, type Minute, type Second } from './date-unit.js'; import { type DayOfWeekIndex } from './day-of-week.js'; import { type DayOfMonth, type MonthNumber } from './month.js'; /** * Checks if input is a valid month number. * * @category Assertion */ export declare function isValidMonthNumber(input: number): input is MonthNumber; /** * Checks if input is a valid day of the week index. * * @category Assertion */ export declare function isValidDayOfWeekIndex(input: number): input is DayOfWeekIndex; /** * Checks if input is a valid day of month number. * * @category Assertion */ export declare function isValidDayOfMonth(input: number): input is DayOfMonth; /** * Checks if input is a valid hour number. * * @category Assertion */ export declare function isValidHour(input: number): input is Hour; /** * Checks if input is a valid minute number. * * @category Assertion */ export declare function isValidMinute(input: number): input is Minute; /** * Checks if input is a valid second number. * * @category Assertion */ export declare function isValidSecond(input: number): input is Second; /** * Checks if input is a valid millisecond number. * * @category Assertion */ export declare function isValidMillisecond(input: number): boolean; /** * Asserts that the input is a valid month number. * * @category Assertion * @returns The input if the assertion succeeds. * @throws `AssertionError` If the assertion fails. */ export declare function assertWrapMonthNumber(input: number, failureMessage?: string | undefined): MonthNumber; /** * Asserts that the input is a valid day of the week index. * * @category Assertion * @returns The input if the assertion succeeds. * @throws `AssertionError` If the assertion fails. */ export declare function assertWrapDayOfWeekIndex(input: number, failureMessage?: string | undefined): DayOfWeekIndex; /** * Asserts that the input is a valid day of month number. * * @category Assertion * @returns The input if the assertion succeeds. * @throws `AssertionError` If the assertion fails. */ export declare function assertWrapDayOfMonth(input: number, failureMessage?: string | undefined): DayOfMonth; /** * Asserts that the input is a valid hour number. * * @category Assertion * @returns The input if the assertion succeeds. * @throws `AssertionError` If the assertion fails. */ export declare function assertWrapHour(input: number, failureMessage?: string | undefined): Hour; /** * Asserts that the input is a valid minute number. * * @category Assertion * @returns The input if the assertion succeeds. * @throws `AssertionError` If the assertion fails. */ export declare function assertWrapMinute(input: number, failureMessage?: string | undefined): Minute; /** * Asserts that the input is a valid second number. * * @category Assertion * @returns The input if the assertion succeeds. * @throws `AssertionError` If the assertion fails. */ export declare function assertWrapSecond(input: number, failureMessage?: string | undefined): Second; /** * Asserts that the input is a valid millisecond number. * * @category Assertion * @returns The input if the assertion succeeds. * @throws `AssertionError` If the assertion fails. */ export declare function assertWrapMillisecond(input: number, failureMessage?: string | undefined): number;