UNPKG

fake-it-til-you-git

Version:

A modern CLI tool to generate fake Git commit history for your GitHub/GitLab profile

73 lines 2.77 kB
/** * Date handling utilities for the fake-it-til-you-git project */ export interface DateRange { start: Date; end: Date; } /** * Parses a date in YYYY-MM-DD format and returns a Date object * @param dateString Date in YYYY-MM-DD format * @returns Date object or null if the date is invalid */ export declare function parseDate(dateString: string): Date | null; /** * Validates if a date string is valid * @param dateString Date in YYYY-MM-DD format * @returns true if the date is valid, false otherwise */ export declare function isValidDate(dateString: string): boolean; /** * Generates a date range between two given dates * @param startDate Start date * @param endDate End date * @returns Array of Date objects representing each day in the range */ export declare function generateDateRange(startDate: Date, endDate: Date): Date[]; /** * Generates a date range from strings in YYYY-MM-DD format * @param startDateString Start date in YYYY-MM-DD format * @param endDateString End date in YYYY-MM-DD format * @returns Array of Date objects or null if any date is invalid */ export declare function generateDateRangeFromStrings(startDateString: string, endDateString: string): Date[] | null; /** * Calculates the number of days between two dates * @param startDate Start date * @param endDate End date * @returns Number of days between dates (positive if endDate > startDate) */ export declare function daysBetween(startDate: Date, endDate: Date): number; /** * Calculates the number of days between two dates in string format * @param startDateString Start date in YYYY-MM-DD format * @param endDateString End date in YYYY-MM-DD format * @returns Number of days or null if any date is invalid */ export declare function daysBetweenStrings(startDateString: string, endDateString: string): number | null; /** * Formats a date as YYYY-MM-DD string * @param date Date object to format * @returns String in YYYY-MM-DD format */ export declare function formatDate(date: Date): string; /** * Gets today's date in YYYY-MM-DD format * @returns String with today's date */ export declare function getTodayString(): string; /** * Gets a date N days ago from today * @param days Number of days backwards * @returns String with the date in YYYY-MM-DD format */ export declare function getDaysAgo(days: number): string; /** * Validates that a date is within an allowed range * @param dateString Date to validate in YYYY-MM-DD format * @param minDate Minimum allowed date (optional) * @param maxDate Maximum allowed date (optional) * @returns true if the date is in range, false otherwise */ export declare function isDateInRange(dateString: string, minDate?: string, maxDate?: string): boolean; //# sourceMappingURL=dates.d.ts.map