import { DateAdapter, DateTime, INormRuleOptionsBase, IRecurrenceRulesIterator, IRuleOptionsBase, RecurrenceRuleResult, RuleOption, } from '@rschedule/core'; import { RecurrenceRule } from '../utilities/recurrence-rule'; declare module '../../recurrence-rule-options' { namespace RuleOption { type Frequency = | 'MILLISECONDLY' | 'SECONDLY' | 'MINUTELY' | 'HOURLY' | 'DAILY' | 'WEEKLY' | 'MONTHLY' | 'YEARLY'; type Interval = number; type WeekStart = DateAdapter.Weekday; } interface IRuleOptions extends IFrequencyRuleOptions {} interface INormRuleOptions extends INormFrequencyRuleOptions {} } export interface IFrequencyRuleOptions extends IRuleOptionsBase { frequency: RuleOption.Frequency; interval?: RuleOption.Interval; weekStart?: RuleOption.WeekStart; } export interface INormFrequencyRuleOptions extends INormRuleOptionsBase { frequency: RuleOption.Frequency; interval: RuleOption.Interval; weekStart: RuleOption.WeekStart; } export declare class FrequencyRule extends RecurrenceRule< INormFrequencyRuleOptions > { protected initDate: DateTime; protected readonly intervalUnit: DateAdapter.TimeUnit | 'week'; protected firstIntervalStartDate: DateTime; protected intervalStartDate: DateTime; protected intervalEndDate: DateTime; constructor( processor: IRecurrenceRulesIterator, initDate: DateTime, ); run(date: DateTime): RecurrenceRuleResult; validateDate(arg: RecurrenceRuleResult): RecurrenceRuleResult; protected setToCurrentInterval(): DateTime; protected normalizedStartDate(date: DateTime): DateTime; protected normalizedEndDate(start: DateTime): DateTime; protected skipToInterval(date: DateTime): void; protected dateIsWithinInterval(date: DateTime): boolean; protected intervalDifference(date: DateTime): number; } /** * Given the frequency (unit) and interval, this function finds * how many jumps forward the first date needs in order to equal * or exceed the second date. * * For example: * * 1. Unit is daily and interval is 1. The second date is 3 days * after the first. This will return 3. * 2. Unit is yearly and interval is 1. The second date is 3 days * after the first. This will return 0. * 3. Unit is yearly and interval is 3. The second date is 4 years * after the first. This will return 6. */ export declare function intervalDifferenceBetweenDates({ first, second, unit, interval, weekStart, direction, }: { first: DateTime; second: DateTime; unit: DateAdapter.TimeUnit | 'week'; interval: number; weekStart: DateAdapter.Weekday; direction: 'after' | 'before'; }): number;