@date-vir/duration
Version:
Durations units an utils for date-vir.
117 lines (116 loc) • 3.82 kB
TypeScript
import { Quarter } from './date-unit.js';
import { DayOfWeekIndex } from './day-of-week.js';
import { DayOfMonth, type MonthNumber } from './month.js';
import { Hour, Minute, Second } from './time-units.js';
/**
* Checks if input is a valid quarter number.
*
* @category Assertion
*/
export declare function isValidQuarter(input: number): input is Quarter;
/**
* 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 quarter number.
*
* @category Assertion
* @returns The input if the assertion succeeds.
* @throws `AssertionError` If the assertion fails.
*/
export declare function assertWrapQuarter(input: number, failureMessage?: string | undefined): Quarter;
/**
* 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;