import { Type, ClassProvider } from '@angular/core'; /** * An abstraction that can be used to create and modify date time objects * immutably regardless of the underlying implementation. */ interface NgpDateAdapter { /** * Create a new date time object. Here `month` is one-based (1-12), matching * the `NgpDateUnits` documentation. Note this differs from `set` and * `getMonth`, which use a zero-based month (0-11). */ create(values: NgpDateUnits): T; /** * Create a new date with the current date and time. */ now(): T; /** * Set the specified units on the date time object, leaving the rest * unchanged. Here `month` is zero-based (0-11), matching `getMonth` so * `set(date, { month: getMonth(other) })` round-trips. Note this differs from * `create`, which takes a one-based month (1-12). */ set(date: T, values: NgpDateUnits): T; /** * Add a duration to the date time object. */ add(date: T, duration: NgpDuration): T; /** * Subtract a duration from the date time object. */ subtract(date: T, duration: NgpDuration): T; /** * Compare two date time objects. */ compare(a: T, b: T): number; /** * Determine if two date time objects are equal. */ isEqual(a: T, b: T): boolean; /** * Determine if a date time object is before another. */ isBefore(a: T, b: T): boolean; /** * Determine if a date time object is after another. */ isAfter(a: T, b: T): boolean; /** * Determine if two date objects are on the same day. */ isSameDay(a: T, b: T): boolean; /** * Determine if two date objects are on the same month. */ isSameMonth(a: T, b: T): boolean; /** * Determine if two date objects are on the same year. */ isSameYear(a: T, b: T): boolean; /** * Get the year. */ getYear(date: T): number; /** * Get the month as a zero-based number (0-11, January = 0). This matches the * range accepted by `set`, so `set(date, { month: getMonth(other) })` round-trips. */ getMonth(date: T): number; /** * Get the date. */ getDate(date: T): number; /** * Get the day of the week as a number (1-7). * - `1` = Monday * - `2` = Tuesday * - `3` = Wednesday * - `4` = Thursday * - `5` = Friday * - `6` = Saturday * - `7` = Sunday */ getDay(date: T): number; /** * Get the hours. */ getHours(date: T): number; /** * Get the minutes. */ getMinutes(date: T): number; /** * Get the seconds. */ getSeconds(date: T): number; /** * Get the milliseconds. */ getMilliseconds(date: T): number; /** * Get the first day of the month. */ startOfMonth(date: T): T; /** * Get the last day of the month. */ endOfMonth(date: T): T; /** * Get the start of the day. */ startOfDay(date: T): T; /** * Get the end of the day. */ endOfDay(date: T): T; } interface NgpDateUnits { /** * The year. */ year?: number; /** * The month 1-12. */ month?: number; /** * The day. */ day?: number; /** * The hour. */ hour?: number; /** * The minute. */ minute?: number; /** * The second. */ second?: number; /** * The millisecond. */ millisecond?: number; } interface NgpDuration { /** * The years. */ years?: number; /** * The months. */ months?: number; /** * The days. */ days?: number; /** * The hours. */ hours?: number; /** * The minutes. */ minutes?: number; /** * The seconds. */ seconds?: number; /** * The milliseconds. */ milliseconds?: number; } /** * Inject the DateAdapter instance */ declare function injectDateAdapter(): NgpDateAdapter; /** * Provide the DateAdapter instance */ declare function provideDateAdapter(adapter: Type>): ClassProvider; declare class NgpNativeDateAdapter implements NgpDateAdapter { /** * Create a new date time object. */ create({ day, hour, minute, month, second, year, millisecond }: NgpDateUnits): Date; /** * Create a new date with the current date and time. */ now(): Date; /** * Set the year of the date time object based on a duration. */ set(date: Date, values: NgpDateUnits): Date; /** * Add a duration to the date time object. */ add(date: Date, duration: NgpDuration): Date; /** * Subtract a duration from the date time object */ subtract(date: Date, duration: NgpDuration): Date; /** * Apply a duration in `sign` direction. Year/month are applied first with the * day clamped to the target month's length (so 31 Jan + 1 month is 28 Feb, not * 3 Mar), matching the Luxon and date-fns adapters; day/time deltas follow. */ private shift; /** * Compare two date time objects */ compare(a: Date, b: Date): number; /** * Determine if two date time objects are equal. */ isEqual(a: Date, b: Date): boolean; /** * Determine if a date time object is before another. */ isBefore(a: Date, b: Date): boolean; /** * Determine if a date time object is after another. */ isAfter(a: Date, b: Date): boolean; /** * Determine if two date objects are on the same day. */ isSameDay(a: Date, b: Date): boolean; /** * Determine if two date objects are on the same month. */ isSameMonth(a: Date, b: Date): boolean; /** * Determine if two date objects are on the same year. */ isSameYear(a: Date, b: Date): boolean; /** * Get the year. */ getYear(date: Date): number; /** * Get the month. */ getMonth(date: Date): number; /** * Get the day of the week as a number (1-7). * - `1` = Monday * - `2` = Tuesday * - `3` = Wednesday * - `4` = Thursday * - `5` = Friday * - `6` = Saturday * - `7` = Sunday */ getDay(date: Date): number; /** * Get the date. */ getDate(date: Date): number; /** * Get the hours. */ getHours(date: Date): number; /** * Get the minutes. */ getMinutes(date: Date): number; /** * Get the seconds. */ getSeconds(date: Date): number; /** * Get the milliseconds. */ getMilliseconds(date: Date): number; /** * Get the first day of the month. */ startOfMonth(date: Date): Date; /** * Get the last day of the month. */ endOfMonth(date: Date): Date; /** * Get the start of the day. */ startOfDay(date: Date): Date; /** * Get the end of the day. */ endOfDay(date: Date): Date; } export { NgpNativeDateAdapter, injectDateAdapter, provideDateAdapter }; export type { NgpDateAdapter, NgpDateUnits, NgpDuration };