@tongziyang/uni-calendar-plugin
Version:
A comprehensive calendar plugin for uniapp with support for Gregorian and Lunar calendars, date selection, hotel booking, check-in functionality, and more.
57 lines (56 loc) • 1.39 kB
TypeScript
/**
* 农历日期计算工具
* 基于寿星万年历算法
*/
export declare const LUNAR_INFO: number[];
/**
* 公历日期转农历日期
* @param date 公历日期
* @returns 农历日期信息
*/
export declare function solarToLunar(date: Date): {
lunarYear: string;
lunarMonth: string;
lunarDay: string;
lunarFestival?: string;
solarFestival?: string;
solarTerm?: string;
};
/**
* 获取节假日信息
* @param date 公历日期
* @returns 节假日信息
*/
export interface HolidayPeriod {
name: string;
startDate: string;
endDate: string;
isRestDay: boolean;
}
/**
* 从本地缓存获取节假日数据
* @returns 节假日数据数组
*/
export declare function getHolidayPeriodsFromCache(): HolidayPeriod[];
/**
* 保存节假日数据到本地缓存
* @param periods 节假日数据数组
*/
export declare function saveHolidayPeriodsToCache(periods: HolidayPeriod[]): void;
/**
* 从外部API更新节假日数据
* @param apiUrl API地址
* @returns 是否更新成功的Promise
*/
export declare function updateHolidayPeriodsFromApi(apiUrl: string): Promise<boolean>;
/**
* 获取节假日信息
* @param date 日期
* @returns 节假日信息
*/
export declare function getHolidayInfo(date: Date): {
name?: string;
isHoliday?: boolean;
isRestDay: boolean;
isHolidayPeriod?: boolean;
};