@meleon/uni-ui
Version:
A uniapp components library written in vue3 and typescript
42 lines (41 loc) • 1.46 kB
TypeScript
import dayjs from 'dayjs';
import type { Dayjs, ManipulateType, OpUnitType } from 'dayjs';
export declare function getNow(): dayjs.Dayjs;
/**
* @description 判断时间是否相同
* @param prevDate
* @param currentDate
* @returns
*/
export declare function isDateValueChange(prevDate: Dayjs | undefined, currentDate: Dayjs | undefined): boolean;
/**
* @description 将用户传入的 Date 转换为 Dayjs
* @param val Date
* @param format string
* @returns
*/
export declare function convertDate2Dayjs(val: MeleonDatetime.DateValue | undefined, format: string): dayjs.Dayjs | undefined;
/**
* @description 将内部的 Dayjs 转换为返给用户的时间
* @param time Dayjs
* @param format 格式
* @returns
*/
export declare function convertDayjs2FormatValue(time: Dayjs | undefined, format: string): string | undefined;
/**
* @description 获取日期数据
* @param value
*/
export declare function getDateValue(value: Dayjs): Date;
export declare const methods: {
add(time: Dayjs, value: number, unit: ManipulateType): dayjs.Dayjs;
startOf(time: Dayjs, unit: OpUnitType): dayjs.Dayjs;
subtract(time: Dayjs, value: number, unit: ManipulateType): dayjs.Dayjs;
};
/**
* @description 返回给使用者的日期数据
* @param date
* @param format
* @returns
*/
export declare function getReturnValue(date: Dayjs, format?: MeleonDatetime.DateFormat): string | number | Date;