UNPKG

@pisell/pisellos

Version:

一个可扩展的前端模块化SDK框架,支持插件系统

42 lines (41 loc) 1.7 kB
import { Module, PisellCore, ModuleOptions } from '../../types'; import { BaseModule } from '../BaseModule'; import { DateModuleAPI, IGetAvailableTimeListParams, ITime } from './types'; export declare class DateModule extends BaseModule implements Module, DateModuleAPI { protected defaultName: string; protected defaultVersion: string; private store; private request; private cacheId; private openCache; private fatherModule; constructor(name?: string, version?: string); initialize(core: PisellCore, options: ModuleOptions): Promise<void>; setDateRange(dateRange: ITime[]): void; getDateRange(): ITime[]; getResourceDates(params: IGetAvailableTimeListParams): Promise<ITime[]>; getDateList(): ITime[]; setDateList(dateList: ITime[]): void; fetchResourceDates(params: IGetAvailableTimeListParams): Promise<any>; /** * 将时间向上取整到下一个10分钟整数 * * @param time dayjs 时间对象 * @returns 向上取整后的时间字符串 (YYYY-MM-DD HH:mm 格式) */ private roundUpToNext10Minutes; /** * 校正资源时间段数据 * * 如果时间段的 start_at 早于资源的 start_time,将其同步为 start_time 的下一个10分钟整数 * 如果修正后 end_at 也早于修正后的 start_time,则删除该时间段 * * @param resourcesData 资源数据数组 * @returns 校正后的资源数据数组 */ private correctResourceTimeSlots; getResourceAvailableTimeList(params: IGetAvailableTimeListParams): Promise<ITime[]>; clearDateRange(): void; storeChange(): void; getResourcesListByDate(date: string): any[]; }