/** * A lightweight date utility class for parsing, formatting, and manipulating dates. */ declare class ProDate { private date; constructor(date?: string | number | Date); /** * Create a ProDate instance from a string. * @param dateString - A date string to parse. */ static fromString(dateString: string): ProDate; /** * Create a ProDate instance from a timestamp. * @param timestamp - The number of milliseconds since January 1, 1970. */ static fromTimestamp(timestamp: number): ProDate; /** * Create a new ProDate instance representing the current date and time. */ static now(): ProDate; /** * Formats the date according to the specified format string. * * ### Supported Format Tokens: * * #### **Year**: * - `YYYY`: Full year (e.g., 2024) * - `YY`: Two-digit year (e.g., 24) * - `Y`: Year without padding (e.g., 2024) * * #### **Quarter**: * - `Q`: Quarter of the year (1-4) * * #### **Month**: * - `MMMM`: Full month name (e.g., January) * - `MMM`: Abbreviated month name (e.g., Jan) * - `MM`: Two-digit month (01-12) * - `M`: Month without padding (1-12) * - `Mo`: Month as an ordinal number (e.g., 1st, 2nd) * * #### **Day of Month**: * - `DD`: Two-digit day of the month (01-31) * - `D`: Day of the month without padding (1-31) * - `Do`: Ordinal day of the month (e.g., 1st, 2nd) * * #### **Day of Year**: * - `DDD`: Three-digit day of the year (001-365 or 366) * - `DDDD`: Day of the year (1-365 or 366) * * #### **Day of Week**: * - `dddd`: Full day name (e.g., Monday) * - `ddd`: Abbreviated day name (e.g., Mon) * - `dd`: Minimal day name (e.g., Mo, Tu) * - `d`: Day of the week (0 = Sunday, 6 = Saturday) * - `E`: ISO day of the week (1 = Monday, 7 = Sunday) * * #### **Week of Year**: * - `w`: Week of the year (1-52 or 1-53) * - `ww`: Week of the year, zero-padded (01-52 or 01-53) * - `W`: ISO week of the year (1-52 or 1-53) * - `WW`: ISO week of the year, zero-padded (01-52 or 01-53) * * #### **Hour (24-hour format)**: * - `HH`: Two-digit hour in 24-hour format (00-23) * - `H`: Hour in 24-hour format (0-23) * * #### **Hour (12-hour format)**: * - `hh`: Two-digit hour in 12-hour format (01-12) * - `h`: Hour in 12-hour format (1-12) * * #### **Minute**: * - `mm`: Two-digit minutes (00-59) * - `m`: Minutes without padding (0-59) * * #### **Second**: * - `ss`: Two-digit seconds (00-59) * - `s`: Seconds without padding (0-59) * * #### **Fractional Seconds**: * - `SSS`: Three-digit milliseconds (000-999) * - `SS`: Hundredths of a second (00-99) * - `S`: Tenths of a second (0-9) * * #### **Period (AM/PM)**: * - `A`: Uppercase AM/PM * - `a`: Lowercase am/pm * * #### **Timezone**: * - `Z`: Timezone offset with colon (e.g., +02:00) * - `ZZ`: Timezone offset without colon (e.g., +0200) * - `z`: Abbreviated timezone name (e.g., EST, PST) * * #### **Unix Timestamp**: * - `X`: Unix timestamp in seconds * - `x`: Unix timestamp in milliseconds * * #### **Custom Formats**: * - `LT`: Time in format 'h:mm A' (e.g., 2:30 PM) * - `LTS`: Time in format 'h:mm:ss A' (e.g., 2:30:15 PM) * - `L`: Date in format 'MM/DD/YYYY' (e.g., 02/27/2024) * - `LL`: Date in format 'MMMM D, YYYY' (e.g., February 27, 2024) * - `LLL`: DateTime in format 'MMMM D, YYYY h:mm A' (e.g., February 27, 2024 2:30 PM) * - `LLLL`: DateTime in format 'dddd, MMMM D, YYYY h:mm A' (e.g., Tuesday, February 27, 2024 2:30 PM) * * @param formatString - The format string containing tokens. */ format(formatString: string): string; /** * Helper function to get ordinal suffix for a given number. * E.g., 1 -> 'st', 2 -> 'nd', 3 -> 'rd', etc. */ private getOrdinal; /** * Helper function to get the day of the year (1-365 or 1-366 for leap years). */ private getDayOfYear; /** * Helper function to get the week number (ISO 8601). */ private getWeekOfYear; /** * Helper function to get the ISO week number (week starting on Monday). */ private getISOWeekOfYear; /** * Helper function to format the timezone offset. * @param colon - Whether to include a colon in the offset (e.g., +02:00 vs +0200). */ private formatTimezoneOffset; /** * Helper function to get the timezone name (abbreviation). */ private getTimeZoneName; /** * Converts the date to an ISO 8601 string (e.g., '2024-09-23T14:00:00Z'). */ toISOString(): string; /** * Converts the date to a UTC string. */ toUTCString(): string; /** * Converts the date to a locale string, using an optional locale parameter. * @param locale - The locale to use for formatting (default is 'en-US'). */ toLocaleString(locale?: string): string; /** * Gets the full year of the date (e.g., 2024). */ getYear(): number; /** * Gets the month of the date (1-12). */ getMonth(): number; /** * Gets the day of the month (1-31). */ getDayOfMonth(): number; /** * Gets the day of the week (0 = Sunday, 6 = Saturday). */ getDayOfWeek(): number; /** * Gets the hours (0-23). */ getHours(): number; /** * Gets the minutes (0-59). */ getMinutes(): number; /** * Gets the seconds (0-59). */ getSeconds(): number; /** * Gets the milliseconds (0-999). */ getMilliseconds(): number; /** * Adds the specified number of years to the date. * @param amount - The number of years to add. */ addYears(amount: number): ProDate; /** * Adds the specified number of months to the date. * @param amount - The number of months to add. */ addMonths(amount: number): ProDate; /** * Adds the specified number of days to the date. * @param amount - The number of days to add. */ addDays(amount: number): ProDate; /** * Adds the specified number of hours to the date. * @param amount - The number of hours to add. */ addHours(amount: number): ProDate; /** * Adds the specified number of minutes to the date. * @param amount - The number of minutes to add. */ addMinutes(amount: number): ProDate; /** * Adds the specified number of seconds to the date. * @param amount - The number of seconds to add. */ addSeconds(amount: number): ProDate; /** * Subtracts the specified number of years from the date. * @param amount - The number of years to subtract. */ subtractYears(amount: number): ProDate; /** * Subtracts the specified number of months from the date. * @param amount - The number of months to subtract. */ subtractMonths(amount: number): ProDate; /** * Subtracts the specified number of days from the date. * @param amount - The number of days to subtract. */ subtractDays(amount: number): ProDate; /** * Subtracts the specified number of hours from the date. * @param amount - The number of hours to subtract. */ subtractHours(amount: number): ProDate; /** * Subtracts the specified number of minutes from the date. * @param amount - The number of minutes to subtract. */ subtractMinutes(amount: number): ProDate; /** * Subtracts the specified number of seconds from the date. * @param amount - The number of seconds to subtract. */ subtractSeconds(amount: number): ProDate; /** * Determines if this date is the same day as the provided date. * @param otherDate - The other ProDate instance to compare to. */ isSameDay(otherDate: ProDate): boolean; /** * Gets the timestamp (milliseconds since January 1, 1970). */ getTime(): number; /** * Returns the number of days in the current month. */ daysInMonth(): number; /** * Sets the time to the start of the day (00:00:00). */ startOfDay(): ProDate; /** * Sets the time to the end of the day (23:59:59.999). */ endOfDay(): ProDate; /** * Sets the date to the start of the current month. */ startOfMonth(): ProDate; /** * Sets the date to the end of the current month. */ endOfMonth(): ProDate; /** * Validates if the date is a valid Date object. */ isValid(): boolean; /** * Checks if the date falls on a weekend (Saturday or Sunday). */ isWeekend(): boolean; /** * Adds business days (Monday to Friday) to the date, skipping weekends. * @param days - The number of business days to add. */ addBusinessDays(days: number): ProDate; /** * Subtracts business days (Monday to Friday) from the date, skipping weekends. * @param days - The number of business days to subtract. */ subtractBusinessDays(days: number): ProDate; /** * Gets the quarter of the year (1-4). */ getQuarter(): number; /** * Adds the specified number of quarters to the date. * @param quarters - The number of quarters to add. */ addQuarters(quarters: number): ProDate; /** * Subtracts the specified number of quarters from the date. * @param quarters - The number of quarters to subtract. */ subtractQuarters(quarters: number): ProDate; /** * Gets the start of the current quarter. */ startOfQuarter(): ProDate; /** * Gets the end of the current quarter. */ endOfQuarter(): ProDate; /** * Adds the specified number of weeks to the date. * @param weeks - The number of weeks to add. */ addWeeks(weeks: number): ProDate; /** * Subtracts the specified number of weeks from the date. * @param weeks - The number of weeks to subtract. */ subtractWeeks(weeks: number): ProDate; /** * Gets the start of the current week (Monday). */ startOfWeek(): ProDate; /** * Gets the end of the current week (Sunday). */ endOfWeek(): ProDate; /** * Checks if the current year is a leap year. */ isLeapYear(): boolean; /** * Gets the number of days in the current year (365 or 366). */ daysInYear(): number; /** * Adds the specified number of fiscal years to the date (assuming fiscal year starts in April). * @param years - The number of fiscal years to add. */ addFiscalYears(years: number): ProDate; /** * Gets the start of the fiscal year (assuming fiscal year starts in April). */ startOfFiscalYear(): ProDate; /** * Gets the end of the fiscal year (assuming fiscal year ends in March). */ endOfFiscalYear(): ProDate; /** * Checks if the current date is a weekday (Monday-Friday). */ isWeekday(): boolean; /** * Converts the current date to a Unix timestamp. */ toUnixTimestamp(): number; /** * Gets the timezone offset in minutes. */ getTimezoneOffset(): number; /** * Converts the current date to UTC. */ toUTC(): ProDate; /** * Converts the current date to local time. */ toLocal(): ProDate; /** * Checks if the current date is in the past. */ isPast(): boolean; /** * Checks if the current date is in the future. */ isFuture(): boolean; /** * Checks if the current date is today. */ isToday(): boolean; /** * Rounds the date to the nearest minute. */ roundToNearestMinute(): ProDate; /** * Rounds the date to the nearest hour. */ roundToNearestHour(): ProDate; /** * Rounds the date to the nearest day. */ roundToNearestDay(): ProDate; /** * Sets the year of the date. * @param year - The year to set. */ setYear(year: number): ProDate; /** * Sets the month of the date (1-12). * @param month - The month to set (1 = January, 12 = December). */ setMonth(month: number): ProDate; /** * Sets the day of the month (1-31). * @param day - The day of the month to set. */ setDayOfMonth(day: number): ProDate; /** * Sets the hours of the date (0-23). * @param hours - The hours to set. */ setHours(hours: number): ProDate; /** * Sets the minutes of the date (0-59). * @param minutes - The minutes to set. */ setMinutes(minutes: number): ProDate; /** * Sets the seconds of the date (0-59). * @param seconds - The seconds to set. */ setSeconds(seconds: number): ProDate; /** * Sets the milliseconds of the date (0-999). * @param milliseconds - The milliseconds to set. */ setMilliseconds(milliseconds: number): ProDate; /** * Gets the difference between this date and another date in days. * @param otherDate - The date to compare with. */ differenceInDays(otherDate: ProDate): number; /** * Gets the difference between this date and another date in hours. * @param otherDate - The date to compare with. */ differenceInHours(otherDate: ProDate): number; /** * Gets the difference between this date and another date in minutes. * @param otherDate - The date to compare with. */ differenceInMinutes(otherDate: ProDate): number; /** * Gets the difference between this date and another date in seconds. * @param otherDate - The date to compare with. */ differenceInSeconds(otherDate: ProDate): number; /** * Gets the start of the current decade. */ startOfDecade(): ProDate; /** * Gets the end of the current decade. */ endOfDecade(): ProDate; /** * Gets the start of the current century. */ startOfCentury(): ProDate; /** * Gets the end of the current century. */ endOfCentury(): ProDate; /** * Gets the start of the current millennium. */ startOfMillennium(): ProDate; /** * Gets the end of the current millennium. */ endOfMillennium(): ProDate; /** * Gets the number of weeks in the current year (52 or 53 weeks). */ weeksInYear(): number; /** * Adds a number of milliseconds to the date. * @param milliseconds - The number of milliseconds to add. */ addMilliseconds(milliseconds: number): ProDate; /** * Subtracts a number of milliseconds from the date. * @param milliseconds - The number of milliseconds to subtract. */ subtractMilliseconds(milliseconds: number): ProDate; /** * Checks if the current date is the start of the month. */ isStartOfMonth(): boolean; /** * Checks if the current date is the end of the month. */ isEndOfMonth(): boolean; /** * Checks if the current date is the start of the week (Monday). */ isStartOfWeek(): boolean; /** * Checks if the current date is the end of the week (Sunday). */ isEndOfWeek(): boolean; /** * Returns the current date as a JavaScript object. */ toJSObject(): Object; /** * Gets the number of seconds since the Unix epoch. */ getEpochSeconds(): number; /** * Returns the current date in the ISO 8601 week date format (YYYY-Www-D). */ toISOWeekDate(): string; /** * Converts the current date to the ISO 8601 string (YYYY-MM-DDTHH:mm:ss.sssZ). */ toISO8601(): string; /** * Adds the specified number of leap years to the current date. * @param leapYears - The number of leap years to add. */ addLeapYears(leapYears: number): ProDate; /** * Subtracts the specified number of leap years from the current date. * @param leapYears - The number of leap years to subtract. */ subtractLeapYears(leapYears: number): ProDate; /** * Checks if the current date is a holiday (based on a predefined list of holidays). * @param holidays - An array of holiday strings in 'MM-DD' format. */ isHoliday(holidays: string[]): boolean; /** * Gets the start of the next day. */ startOfNextDay(): ProDate; /** * Gets the end of the previous day. */ endOfPreviousDay(): ProDate; /** * Adds or subtracts the specified number of decades. * @param decades - The number of decades to add or subtract. */ addDecades(decades: number): ProDate; /** * Subtracts the specified number of decades. * @param decades - The number of decades to subtract. */ subtractDecades(decades: number): ProDate; /** * Adds or subtracts the specified number of centuries. * @param centuries - The number of centuries to add or subtract. */ addCenturies(centuries: number): ProDate; /** * Subtracts the specified number of centuries. * @param centuries - The number of centuries to subtract. */ subtractCenturies(centuries: number): ProDate; /** * Checks if the current time is before noon (12:00 PM). */ isBeforeNoon(): boolean; /** * Checks if the current time is after noon (12:00 PM). */ isAfterNoon(): boolean; /** * Checks if the current date is in the current decade. */ isInCurrentDecade(): boolean; /** * Checks if the current date is in the current century. */ isInCurrentCentury(): boolean; /** * Converts the current date to a simple human-readable format (e.g., "2 days ago", "in 3 hours"). */ toHumanReadable(): string; /** * Adds or subtracts a specific unit (like years, months, days) from the date. * @param amount - The amount to add or subtract (use negative for subtraction). * @param unit - The unit ('years', 'months', 'days', etc.). */ addSubtract(amount: number, unit: string): ProDate; /** * Gets the number of days in a specific month of a given year. * @param year - The year. * @param month - The month (1-12). */ static daysInMonth(year: number, month: number): number; /** * Checks if a specific date is a leap year. * @param year - The year. */ static isLeapYear(year: number): boolean; /** * Returns the difference between two dates in a specific unit. * @param date - The date to compare with. * @param unit - The unit of difference ('years', 'months', 'days', etc.). */ diff(date: ProDate, unit: string): number; /** * Returns the start of a given unit of time. * @param unit - The unit ('year', 'month', 'week', 'day', 'hour', etc.). */ startOf(unit: string): ProDate; /** * Returns the end of a given unit of time. * @param unit - The unit ('year', 'month', 'week', 'day', 'hour', etc.). */ endOf(unit: string): ProDate; /** * Checks if the current date is before a given date. * @param date - The date to compare with. */ isBefore(date: ProDate): boolean; /** * Checks if the current date is after a given date. * @param date - The date to compare with. */ isAfter(date: ProDate): boolean; /** * Checks if two dates are the same in terms of a specific unit (e.g., same year, month, etc.). * @param date - The date to compare with. * @param unit - The unit to compare ('year', 'month', 'day', etc.). */ isSame(date: ProDate, unit: string): boolean; /** * Formats the date in relative time (e.g., '2 hours ago', 'in 3 days') with full configurability. * * ### Features: * - **Units Supported**: Seconds, Minutes, Hours, Days, Weeks, Months, Years. * - **Pluralization**: Automatically adjusts for singular or plural forms. * - **Past and Future**: Handles both past and future dates, with correct phrasing. * - **Thresholds**: Customizable thresholds for rounding and displaying "just now" for recent times. * - **Granularity**: Supports fine-grained time differences (e.g., "3 minutes", "2 days"). * * @param date - The date to compare with (optional, defaults to now). * @param options - Optional configuration: * - `round`: Whether to round time units (default: true). * - `thresholds`: Custom time thresholds for switching between units. * - `futureText`: Text for future times (default: "in"). * - `pastText`: Text for past times (default: "ago"). * - `justNowText`: Text for very recent times (default: "just now"). * - `maxUnits`: Maximum number of units to display (e.g., 1 shows "1 day ago" instead of "1 day, 3 hours ago"). * @returns A relative time string (e.g., '2 hours ago', 'in 3 days'). */ fromNow(date?: ProDate, options?: { round?: boolean; thresholds?: { seconds?: number; minutes?: number; hours?: number; days?: number; weeks?: number; months?: number; years?: number; }; futureText?: string; pastText?: string; justNowText?: string; maxUnits?: number; }): string; /** * Helper function to pluralize units (e.g., '1 minute' vs '2 minutes'). * @param value - The number of units. * @param unit - The unit to pluralize. */ private pluralize; /** * Returns a human-readable string indicating how long ago the date was or how far in the future it is. * * ### Features: * - **Singular/Plural**: Automatically adjusts for singular or plural forms. * - **Supports Past and Future Dates**: Can handle both past and future dates. * - **Configurable Precision**: Can display seconds, minutes, hours, or days based on the difference. * - **Customizable Rounding**: Optionally enable or disable rounding. * * @param options - Optional configuration for the output: * - `round`: Whether to round time units (default: true). * - `futureText`: Text for future times (default: "in"). * - `pastText`: Text for past times (default: "ago"). * - `justNowText`: Text for very recent times (default: "just now"). * - `maxUnits`: Maximum number of units to display (default: 1). * @returns A relative time string (e.g., '2 hours ago', 'in 3 days'). */ timeAgo(options?: { round?: boolean; futureText?: string; pastText?: string; justNowText?: string; maxUnits?: number; }): string; /** * Parses a date string in the ISO 8601 format. * @param isoString - The ISO string to parse. */ static fromISO(isoString: string): ProDate; /** * Parses a date string from a Unix timestamp (in seconds). * @param unixSeconds - The Unix timestamp in seconds. */ static fromUnix(unixSeconds: number): ProDate; /** * Checks if the current date is within a specific date range. * @param startDate - The start date. * @param endDate - The end date. */ isBetween(startDate: ProDate, endDate: ProDate): boolean; /** * Returns the number of business days between two dates (excluding weekends). * @param date - The date to compare with. */ businessDaysBetween(date: ProDate): number; /** * Formats the date as 'Day Month Year' (e.g., '27 February 2024'). */ formatDayMonthYear(): string; /** * Returns the start of the next month. */ startOfNextMonth(): ProDate; /** * Returns the end of the previous month. */ endOfPreviousMonth(): ProDate; /** * Formats the date using the "full" locale string format (e.g., Tuesday, February 27, 2024 2:30 PM). */ formatFull(): string; /** * Converts the current date to an array `[year, month, day, hour, minute, second, millisecond]`. */ toArray(): number[]; /** * Converts the current date to a JavaScript object. */ toObject(): { year: number; month: number; day: number; hour: number; minute: number; second: number; millisecond: number; }; /** * Converts the date to JSON format. */ toJSON(): string; /** * Returns the difference between two dates in quarters. * @param date - The date to compare. */ diffInQuarters(date: ProDate): number; /** * Returns the difference between two dates in business days (Monday-Friday). * @param date - The date to compare with. */ diffInBusinessDays(date: ProDate): number; /** * Gets the ISO week number of the year. */ getISOWeek(): number; /** * Gets the ISO year corresponding to the ISO week number. */ getISOYear(): number; /** * Checks if the current date falls within the same ISO week as another date. * @param date - The date to compare. */ isSameISOWeek(date: ProDate): boolean; /** * Checks if the current date falls within the same quarter as another date. * @param date - The date to compare. */ isSameQuarter(date: ProDate): boolean; /** * Checks if the current date falls within the same ISO week as today. */ isThisISOWeek(): boolean; /** * Converts the current date to the Unix timestamp in milliseconds. */ toUnixMilliseconds(): number; /** * Converts the current date to the Unix timestamp in seconds. */ toUnixSeconds(): number; /** * Checks if the current date is in the current quarter. */ isInCurrentQuarter(): boolean; /** * Checks if the date is within the current week. */ isInCurrentWeek(): boolean; /** * Converts the current date to a readable string showing only the time (HH:mm). */ toTimeString(): string; /** * Converts the current date to a readable string showing only the date (YYYY-MM-DD). */ toDateString(): string; /** * Converts the current date to the start of the current UTC day. */ startOfUTCDay(): ProDate; /** * Converts the current date to the end of the current UTC day. */ endOfUTCDay(): ProDate; /** * Returns whether the date is the same year as another date. * @param date - The date to compare. */ isSameYear(date: ProDate): boolean; /** * Checks if the date is tomorrow. */ isTomorrow(): boolean; /** * Checks if the date is yesterday. */ isYesterday(): boolean; /** * Returns the number of remaining days in the current month. */ daysRemainingInMonth(): number; /** * Adds a specific number of years, months, weeks, days, hours, minutes, or seconds to the date. * @param amount - The amount of time to add. * @param unit - The unit of time (e.g., 'years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds'). */ add(amount: number, unit: string): ProDate; /** * Subtracts a specific number of years, months, weeks, days, hours, minutes, or seconds from the date. * @param amount - The amount of time to subtract. * @param unit - The unit of time (e.g., 'years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds'). */ subtract(amount: number, unit: string): ProDate; /** * Returns the first day of the current year. */ startOfYear(): ProDate; /** * Returns the last day of the current year. */ endOfYear(): ProDate; /** * Returns the current date in UTC. */ toUTCDate(): ProDate; /** * Returns the current date in a specified time zone. * @param timeZone - The time zone to convert to (e.g., 'America/New_York'). */ toTimeZone(timeZone: string): ProDate; /** * Checks if the current date is during daylight saving time (DST). */ isDST(): boolean; /** * Checks if the current date is the same as another date (ignoring time). * @param date - The date to compare. */ isSameDate(date: ProDate): boolean; /** * Checks if the current date is the same as another date (including time). * @param date - The date to compare. */ isSameExact(date: ProDate): boolean; /** * Converts the current date to an object with `year`, `month`, `day`, `hour`, `minute`, `second`, `millisecond`. */ toDateObject(): { year: number; month: number; day: number; hour: number; minute: number; second: number; millisecond: number; }; /** * Returns the number of days between the current date and another date. * @param date - The date to compare. */ daysBetween(date: ProDate): number; /** * Returns the number of months between the current date and another date. * @param date - The date to compare. */ monthsBetween(date: ProDate): number; /** * Returns the number of years between the current date and another date. * @param date - The date to compare. */ yearsBetween(date: ProDate): number; /** * Checks if the date falls within the specified date range (inclusive). * @param startDate - The start of the range. * @param endDate - The end of the range. */ isInRange(startDate: ProDate, endDate: ProDate): boolean; /** * Returns the difference between two dates in weeks. * @param date - The date to compare. */ weeksBetween(date: ProDate): number; /** * Returns the first Monday after the current date. */ nextMonday(): ProDate; /** * Checks if the current time is in the AM period. */ isAM(): boolean; /** * Checks if the current time is in the PM period. */ isPM(): boolean; /** * Converts the current date to UTC and returns it as an ISO string. */ toUTCISO(): string; /** * Returns a short localized date string (e.g., '09/23/2023'). * @param locale - The locale to format the date (default: 'en-US'). */ toShortDateString(locale?: string): string; /** * Adds a specified duration to the current date using an object. * @param duration - Object with units like { days: 3, hours: 2 }. */ addDuration(duration: { years?: number; months?: number; weeks?: number; days?: number; hours?: number; minutes?: number; seconds?: number; }): ProDate; /** * Subtracts a specified duration from the current date using an object. * @param duration - Object with units like { days: 3, hours: 2 }. */ subtractDuration(duration: { years?: number; months?: number; weeks?: number; days?: number; hours?: number; minutes?: number; seconds?: number; }): ProDate; /** * Formats the date into a localized human-readable format. * @param locale - The locale to format the date (e.g., 'en-US'). * @param options - Optional formatting options. */ toLocalizedString(locale?: string, options?: Intl.DateTimeFormatOptions): string; /** * Returns the ISO week number for the current date, accounting for years starting on any day. */ getWeekOfYearISO(): number; /** * Returns the difference between two dates as a human-readable string (e.g., "2 days", "3 months"). * @param date - The date to compare. */ humanizeDiff(date: ProDate): string; /** * Parses a date string with the given format. * This function supports a wide range of format tokens and provides flexible parsing capabilities. * * ### Supported Tokens: * - `YYYY` (4-digit year) * - `YY` (2-digit year) * - `MM` (2-digit month) * - `M` (1 or 2-digit month) * - `DD` (2-digit day of the month) * - `D` (1 or 2-digit day of the month) * - `HH` (2-digit 24-hour format) * - `H` (1 or 2-digit 24-hour format) * - `hh` (2-digit 12-hour format) * - `h` (1 or 2-digit 12-hour format) * - `mm` (2-digit minutes) * - `ss` (2-digit seconds) * - `A` / `a` (AM/PM) * * ### Example Usage: * ```typescript * ProDate.parse('2023-09-24 14:30', 'YYYY-MM-DD HH:mm'); * ProDate.parse('09/24/23', 'MM/DD/YY'); * ``` * * @param dateString - The date string to parse (e.g., '2023-09-24'). * @param format - The format of the date string (e.g., 'YYYY-MM-DD'). * @returns A ProDate object. * @throws Will throw an error if the format doesn't match the date string. */ static parse(dateString: string, format: string): ProDate; /** * Adds a specific duration using a string (e.g., '2 years', '3 days'). * @param durationString - The duration string (e.g., '2 years', '3 days'). */ addDurationString(durationString: string): ProDate; /** * Subtracts a specific duration using a string (e.g., '2 years', '3 days'). * @param durationString - The duration string (e.g., '2 years', '3 days'). */ subtractDurationString(durationString: string): ProDate; /** * Returns the difference between two dates in months, rounding down. * @param date - The date to compare. */ diffInFullMonths(date: ProDate): number; /** * Returns the difference between two dates in years, rounding down. * @param date - The date to compare. */ diffInFullYears(date: ProDate): number; /** * Checks if the current date is the same day of the year as another date. * @param date - The date to compare. */ isSameDayOfYear(date: ProDate): boolean; /** * Checks if the current time is between two times on the same day. * @param startTime - The start time in 'HH:mm' format. * @param endTime - The end time in 'HH:mm' format. */ isTimeBetween(startTime: string, endTime: string): boolean; /** * Gets the start of the previous month. */ startOfPreviousMonth(): ProDate; /** * Returns whether the current time is between noon and midnight (PM hours). */ isPMHours(): boolean; /** * Returns whether the current time is between midnight and noon (AM hours). */ isAMHours(): boolean; /** * Checks if the current date falls on the same day of the week as another date. * @param date - The date to compare. */ isSameDayOfWeek(date: ProDate): boolean; /** * Gets the difference between two dates in weeks, rounding down. * @param date - The date to compare. */ diffInFullWeeks(date: ProDate): number; /** * Checks if the current date falls within a leap year. */ isCurrentYearLeap(): boolean; /** * Returns the current quarter's start date. */ startOfCurrentQuarter(): ProDate; /** * Returns the current quarter's end date. */ endOfCurrentQuarter(): ProDate; /** * Returns whether the current date is the first day of the year. */ isFirstDayOfYear(): boolean; /** * Returns whether the current date is the last day of the year. */ isLastDayOfYear(): boolean; /** * Returns a human-readable relative time string with customizable rounding. * @param options - Optional configuration for rounding and units. */ humanizeTimeAgo(options?: { round?: boolean; }): string; /** * Parses a date string in ISO 8601 format. * @param isoString - The ISO string to parse. */ static parseISO(isoString: string): ProDate; } export { ProDate };