/** * Date Utilities Module * * Provides robust date handling utilities with timezone support for BrightChain. * All dates are stored internally in UTC to ensure consistency across timezones. * * @module dateUtils */ /** * Parse a date from various formats (ISO 8601, Unix timestamp). * * Supports: * - ISO 8601 strings (e.g., "2024-01-23T10:30:00Z", "2024-01-23T10:30:00.000Z") * - Unix timestamps in milliseconds (number) * - Unix timestamps in seconds (number < 10000000000) * * @param value - Date string or Unix timestamp * @returns Date object in UTC * @throws Error if date is invalid or malformed * * @example * ```typescript * // Parse ISO 8601 string * const date1 = parseDate("2024-01-23T10:30:00Z"); * * // Parse Unix timestamp (milliseconds) * const date2 = parseDate(1706008200000); * * // Parse Unix timestamp (seconds) * const date3 = parseDate(1706008200); * ``` */ export declare function parseDate(value: string | number): Date; /** * Serialize a date to ISO 8601 format with UTC timezone. * * Always returns dates in UTC timezone with 'Z' suffix. * Format: "YYYY-MM-DDTHH:mm:ss.sssZ" * * @param date - Date to serialize * @returns ISO 8601 string in UTC * @throws Error if date is invalid * * @example * ```typescript * const date = new Date("2024-01-23T10:30:00Z"); * const serialized = serializeDate(date); * // Returns: "2024-01-23T10:30:00.000Z" * ``` */ export declare function serializeDate(date: Date): string; /** * Validate that a date is valid and optionally check if it's not in the future. * * @param date - Date to validate * @param allowFuture - Whether to allow future dates (default: false) * @returns true if valid, false otherwise * * @example * ```typescript * const date = new Date("2024-01-23T10:30:00Z"); * const isValid = isValidDate(date); // true if date is in the past * const isValidFuture = isValidDate(date, true); // true regardless of future/past * ``` */ export declare function isValidDate(date: Date, allowFuture?: boolean): boolean; //# sourceMappingURL=dateUtils.d.ts.map