@uiw/react-native
Version:
UIW for React Native
85 lines (84 loc) • 2.7 kB
TypeScript
import { DateLabel } from './index';
import { DateKey } from './component/PickerView';
import { PickerData } from '../Picker';
export interface Diff {
min: number;
max: number;
}
export interface TimerDiff {
year?: Diff;
month?: Diff;
day?: Diff;
hour?: Diff;
minute?: Diff;
second?: Diff;
}
export interface ResultDate {
year?: PickerData[];
month?: PickerData[];
day?: PickerData[];
hour?: PickerData[];
minute?: PickerData[];
second?: PickerData[];
}
export interface ChangeParams {
MAXTIMER?: DateLabel;
MINTIMER?: DateLabel;
nextLabel?: DateLabel;
prevLabel?: DateLabel;
}
/**
* 校验 precision
* @param precision 精度
* @returns DateKey
*/
export declare function precisionValue(precision: DateKey): DateKey;
/**
* 获得时间 数组 [2021,10,1,10,00,00]
* @param value 时间
* @param type DateKey
* @returns number[]
*/
export declare function setTimer(type: DateKey, value?: string): number[];
/**
* 得到时间差
* @param min 最小时间数组
* @param max 最大时间数组
* @param type 精度
* @returns 时间差 TimerDiff
*/
export declare function setTimerDiff(min: number[], max: number[], type: DateKey): TimerDiff;
/**
* 得到年份数据
* @param star 最小
* @param end 最大
* @returns PickerData[]
*/
export declare function getYears(star: number, end: number): PickerData[];
/** 得到月份 */
export declare function getMonths(initial?: number, type?: 'star' | 'end'): PickerData[];
/** 得到每月天数 */
export declare function getDays(year: number, month: number, initial?: number, type?: 'star' | 'end'): PickerData[];
/** 得到小时 */
export declare function getHours(initial?: number, type?: 'star' | 'end'): PickerData[];
/** 得到分钟或者秒 */
export declare function getMinutesOrSeconds(initial?: number, type?: 'star' | 'end'): PickerData[];
/**
* 计算一个装着时间的数组
* @param star 起始位置
* @param end 结束位置
* @param PrecisionType DateKey
* @returns ResultDate
*/
export declare function getPickerData(timerDiff: TimerDiff, type: DateKey): ResultDate;
/**
* 计算当从最小的时间发生改变应该改变的时节数据
* @param key 发生改变的key
* @param MINTIMER 最小的时间
* @param nextLabel 更改的时间
* @returns 新的时间对象
*/
export declare function minData(key: DateKey, changeParams: ChangeParams, precision: DateKey): ResultDate;
/** 最大时间改变的 */
export declare function maxData(key: DateKey, changeParams: ChangeParams, precision: DateKey): ResultDate;
export declare function changeData(key: DateKey, changeParams: ChangeParams, precision: DateKey): ResultDate;