import { DateAdapter, DateInput } from '@rschedule/core'; import { CollectionIterator, ICollectionsArgs, IOccurrencesArgs, IRunArgs, OccurrenceGenerator, OccurrenceGeneratorRunResult, OccurrenceIterator, } from './occurrence-generator'; export interface IDatesArgs { timezone?: string | null; duration?: number; dates?: ReadonlyArray; data?: D; } export declare class Dates extends OccurrenceGenerator { readonly adapters: ReadonlyArray; get length(): number; /** Returns the first occurrence or, if there are no occurrences, null. */ get firstDate(): DateAdapter | null; /** Returns the last occurrence or, if there are no occurrences, null. */ get lastDate(): DateAdapter | null; readonly isInfinite: boolean; readonly hasDuration: boolean; readonly maxDuration: number; readonly timezone: string | null; /** * Convenience property for holding arbitrary data. Accessible on individual DateAdapters * generated by this `Dates` object via the `DateAdapter#generators` property. Unlike * the rest of the `Dates` object, the data property is mutable. */ data: Data; private readonly datetimes; constructor(args?: IDatesArgs); occurrences(args?: IOccurrencesArgs): OccurrenceIterator<[this]>; collections(args?: ICollectionsArgs): CollectionIterator<[this]>; add(value: DateInput): Dates; remove(value: DateInput): Dates; /** * Dates are immutable. This allows you to create a new `Dates` with the * specified property changed. * * ### Important! * * When updating `Dates#timezone`, this does not actually change the timezone of the * underlying date objects wrapped by this `Dates` instance. Instead, when this `Dates` * object is iterated and a specific date is found to be * valid, only then is that date converted to the timezone you specify here and returned to * you. * * This distinction might matter when viewing the timezone associated with * `Dates#adapters`. If you wish to update the timezone associated with the `date` objects * this `Dates` is wrapping, you must update the individual dates themselves by setting * the `dates` property. * */ set( prop: 'timezone', value: string | null, options?: { keepLocalTime?: boolean; }, ): Dates; /** * Dates are immutable. This allows you to create a new `Dates` with new date objects. */ set(prop: 'dates', value: DateInput[]): Dates; /** * Dates are immutable. This allows you to create a new `Dates` with all of the underlying * date objects set to have the specified `duration`. Duration is a length of time, * expressed in milliseconds. */ set(prop: 'duration', value: number | undefined): Dates; filter( fn: ( date: DateAdapter, index: number, array: ReadonlyArray, ) => boolean, ): Dates; _run(args?: IRunArgs): OccurrenceGeneratorRunResult; }