@zenithui/time-picker
Version:
A ZenithUi Time Picker is React component enables users to select a time from a predefined list of options.
48 lines (47 loc) • 1.54 kB
TypeScript
/**
* Gets the initial hour from a time string.
*
* @param time - The time string to get the initial hour from.
* @returns The initial hour.
*/
export declare function getInitialHour(time: string): string;
/**
* Gets the initial period from a time string.
*
* @param time - The time string to get the initial period from.
* @returns The initial period.
*/
export declare function getInitialPeriod(time: string): "PM" | "AM";
/**
* Converts a time string to 24-hour format.
*
* @param hour - The hour to convert.
* @param period - The period to convert.
* @returns The converted time string.
*/
export declare function convertTo24Hour(hour: string, period: string): string | number;
/**
* Converts a time string to 12-hour format.
* @param hour - The hour to convert.
* @returns The object with the converted hour and period.
*/
export declare function convertTo12Hour(hour: string): {
hour: string;
period: string;
};
/**
* Formats a 24-hour time string to 12-hour format.
*
* @param time24 - The 24-hour time string to format.
* @returns The formatted 12-hour time string.
*/
export declare function formatTime24To12(time24: string): string;
/**
* Generates an array of time options (hours or minutes) as strings,
* padded with leading zeros if necessary.
*
* @param start - Starting number of the range (inclusive).
* @param end - Ending number of the range (inclusive).
* @returns Array of time options as strings.
*/
export declare function generateTimeOptions(start: number, end: number): string[];