import { type FactoryWithRequiredInput, type IndexNumber, type Maybe, type Milliseconds } from '@dereekb/util'; import { type Observable, type SchedulerLike } from 'rxjs'; import { type LogicalDateStringCode } from './date.logical'; /** * Configuration for creating a periodic date-emitting Observable. */ export interface DateIntervalConfig { /** * How often to emit the date. * * Defaults to every second. */ readonly period?: Maybe; /** * Emits the given logical date each interval (e.g. 'now', 'today_start'). */ readonly logicalDate?: Maybe; /** * Custom factory to use for producing each date value. */ readonly factory?: FactoryWithRequiredInput; /** * Whether to emit every interval tick regardless of whether the date changed. False by default. */ readonly emitAll?: boolean; /** * Scheduler for the rxjs interval. */ readonly scheduler?: SchedulerLike | undefined; } /** * Creates an Observable that emits a Date at regular intervals based on the given configuration. * * By default emits the current time every second and deduplicates consecutive equal dates. * * @param config - Interval and date generation configuration. * @returns An Observable that emits Date values. * * @example * ```ts * // Emit start-of-today every 5 seconds * const today$ = dateInterval({ logicalDate: 'today_start', period: 5000 }); * ``` */ export declare function dateInterval(config: DateIntervalConfig): Observable; /** * Convenience function for {@link dateInterval} that emits the current time at each interval tick. * * Unlike the default dateInterval, this always emits (no deduplication) since each "now" is unique. * * @param period - Optional emission interval in milliseconds (defaults to 1 second) * @returns An Observable that emits the current Date. * * @example * ```ts * const now$ = nowInterval(1000); * now$.subscribe((date) => console.log('Current time:', date)); * ``` */ export declare function nowInterval(period?: Maybe): Observable;