ts-time-utils
Version:
A comprehensive TypeScript utility library for time, dates, durations, and calendar operations with full tree-shaking support
31 lines • 1.11 kB
TypeScript
/**
* Advanced date parsing utilities
*/
/**
* Parse various date formats intelligently
* @param input - date string, number, or Date object
*/
export declare function parseDate(input: string | number | Date): Date | null;
/**
* Parse relative date strings like "tomorrow", "next monday", "2 weeks ago"
* @param input - relative date string
*/
export declare function parseRelativeDate(input: string): Date | null;
/**
* Parse "time ago" strings like "5 minutes ago", "2 hours ago"
* @param input - time ago string
*/
export declare function parseTimeAgo(input: string): Date | null;
/**
* Parse custom date format
* @param dateString - date string to parse
* @param format - format pattern (e.g., "YYYY-MM-DD", "DD/MM/YYYY")
*/
export declare function parseCustomFormat(dateString: string, format: string): Date | null;
/**
* Try parsing with multiple formats
* @param dateString - date string to parse
* @param formats - array of format patterns to try
*/
export declare function parseManyFormats(dateString: string, formats: string[]): Date | null;
//# sourceMappingURL=parse.d.ts.map