import { DateTime, DurationLikeObject } from "luxon"; import * as i0 from "@angular/core"; interface IDateRange { to: string; from: string; } interface IAgeObject { value: number; group: string; } export declare class DateService { /** * Calculates the difference in minutes between two DateTime objects. * @param startDate The start date and time. * @param endDate The end date and time. * @returns The difference in minutes between the start and end dates. */ calculateMinutesDifference(startDate: DateTime, endDate: DateTime): number; /** * Converts milliseconds to minutes. * @param milliseconds - The number of milliseconds to convert. * @returns The equivalent number of minutes. */ convertMillisecondsToMinutes(milliseconds: number): number; /** * Calculates the age based on the given date of birth. * @param dateOfBirth - The date of birth to calculate the age from. * @param format - The format of the date of birth. Defaults to 'dd/MM/yyyy'. * @returns The calculated age. */ calculateAge(dateOfBirth: DateTime | string, format?: string): number; /** * Checks if a given date is valid. * @param dateInput - The date to be checked. It can be a DateTime object, a string, or null. * @param format - The format of the date string (default: 'dd/MM/yyyy'). * @returns A boolean indicating whether the date is valid or not. */ isValidDate(dateInput: DateTime | string | null, format?: string): boolean; /** * Returns a string representation of a date subtracted by the given duration. * @param duration A DurationLikeObject representing the amount of time to subtract from the current date. * @returns A string representing the subtracted date in the format specified by the current locale. */ getPreviousDate(duration: DurationLikeObject): string; /** * Parses a string value into a DateTime object based on the specified format. * @param value - The string value to parse. * @param format - The format of the string value. * @returns A DateTime object representing the parsed value. */ getFromFormat(value: string, format: string): DateTime; /** * Returns an object containing the age and age group based on the date of birth. * @param dateOfBirth - The date of birth to calculate the age from. * @returns An object containing the age value and group ('Adult' or 'Youth') if the date is valid, or null if the date is invalid. */ getAgeObject(dateOfBirth: string): IAgeObject | null; /** * Parses a string value into a native JavaScript Date object based on the specified format. * @param value - The string value to parse. * @param format - The format of the string value. * @returns A Date object representing the parsed value, or null if parsing fails. */ getDateFromFormat(value: string, format: string): Date | null; /** * Converts a DateTime value to a formatted string. * * @param value - The DateTime value to format. * @param format - The format string to apply to the DateTime value. * @returns The formatted string representation of the DateTime value. */ toFormat(value: DateTime, format: string): string; /** * Converts a given Date object to a formatted string based on the specified format. * * @param value - The Date object to be formatted. * @param format - The string format to apply to the Date object. * @returns The formatted date string. */ toDateStringFormat(value: Date, format: string): string; /** * Converts a string in ISO format to a DateTime object. * @param value - The string value in ISO format. * @returns A DateTime object representing the given value. */ getFromIso(value: string): DateTime; /** * Returns the current date and time. * @returns {DateTime} The current date and time. */ getDateNow(): DateTime; /** * Adds a duration to a given date and returns the result in the specified format. * @param date - The date to which the duration will be added. * @param years - The number of years to add to the date (default: 0). * @param months - The number of months to add to the date (default: 0). * @param weeks - The number of weeks to add to the date (default: 0). * @param days - The number of days to add to the date (default: 0). * @param format - The format in which the resulting date will be returned (default: 'dd/MM/yyyy'). * @returns The resulting date in the specified format. */ addDurationToDate(date: string, years?: number, months?: number, weeks?: number, days?: number, format?: string): string; /** * Calculates the number of days between two dates. * @param startDate - The start date in the specified format. * @param endDate - The end date in the specified format. * @param format - The format of the dates (default: 'dd/MM/yyyy'). * @returns The number of days between the start and end dates. */ calculateDaysBetweenDates(startDate: string, endDate: string, format?: string): number; /** * Checks if a given date is in the past. * @param date - The date to check. * @param format - The format of the date string. Defaults to 'dd/MM/yyyy'. * @returns True if the date is in the past, false otherwise. */ isDateInThePast(date: string, format?: string): boolean; /** * Checks if a given date is in the future. * @param date - The date to check. * @param yearsInTheFuture - Optional. The number of years in the future to compare against. If not provided, the current date is used. * @param format - Optional. The format of the input date. Defaults to 'dd/MM/yyyy'. * @returns True if the date is in the future, false otherwise. */ isDateInTheFuture(date: string, yearsInTheFuture?: number, format?: string): boolean; /** * Converts a date string from one format to another. * * @param date - The date string to be converted. * @param fromFormat - The format of the input date string. * @param toFormat - The desired format of the output date string. * @returns The date string in the desired format. */ getFromFormatToFormat(date: string, fromFormat: string, toFormat: string): string; /** * Calculates the number of days between the current date and a given ISO date string. * * @param value - An ISO 8601 formatted date string representing the target date. * @returns The number of days between the current date and the input date. * Returns 0 if the input date is invalid. */ getDaysAgo(value: string): number; /** * Returns a date range object with 'from' and 'to' properties. * @param pastDays - The number of days in the past from today. * @param futureDays - The number of days in the future from today. * @param format - The format for the date strings (default: 'yyyy-MM-dd'). * @returns An object containing 'from' and 'to' date strings in the specified format. */ getDateRange(pastDays?: number, futureDays?: number, format?: string): IDateRange; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }