@vtex/admin-ui
Version:
> VTEX admin component library
30 lines (29 loc) • 1.4 kB
TypeScript
export declare function asDate(value: Date | undefined): Date;
export declare function getSegmentLimits(date: Date, type: string, options: Intl.ResolvedDateTimeFormatOptions): {
value: number;
minValue: number;
maxValue: number;
} | {
value?: undefined;
minValue?: undefined;
maxValue?: undefined;
};
export declare function add(value: Date, part: string, amount: number, options: Intl.ResolvedDateTimeFormatOptions): Date;
export declare function cycleValue(value: number, amount: number, min: number, max: number, round?: boolean): number;
export declare function setSegment(value: Date, part: string, segmentValue: number, options: Intl.ResolvedDateTimeFormatOptions): Date;
/**
* Converts unicode number strings to real JS numbers.
* Numbers can be displayed and typed in many number systems, but JS
* only understands latin numbers.
* @see https://www.fileformat.info/info/unicode/category/Nd/list.htm
* for a list of unicode numeric characters.
* Currently only Arabic and Latin numbers are supported, but more
* could be added here in the future.
* Keep this in sync with `isNumeric` below.
*/
export declare function parseNumber(str: string): number;
/**
* Checks whether a unicode string could be converted to a number.
* Keep this in sync with `parseNumber` above.
*/
export declare function isNumeric(str: string): boolean;