UNPKG

igniteui-webcomponents

Version:

Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.

56 lines (55 loc) 2.74 kB
import { CalendarDay, type CalendarRangeParams, type DayParameter } from './model.js'; import { type DateRangeDescriptor, type WeekDays } from './types.js'; export declare const MONTHS_PER_ROW = 3; export declare const YEARS_PER_ROW = 3; export declare const YEARS_PER_PAGE = 15; export declare function isValidDate(date: Date): Date | null; export declare function parseISODate(string: string): Date | null; /** * Converts the given value to a Date object. * * If the value is already a valid Date object, it is returned directly. * If the value is a string, it is parsed into a Date object. * If the value is null or undefined, null is returned. * If the parsing fails, null is returned. */ export declare function convertToDate(value?: Date | string | null): Date | null; /** * Converts a Date object to an ISO 8601 string. * * If the `value` is a `Date` object, it is converted to an ISO 8601 string. * If the `value` is null or undefined, null is returned. */ export declare function getDateFormValue(value: Date | null): string | null; /** * Converts a comma-separated string of ISO 8601 dates or an array of Date objects | ISO 8601 strings into * an array of Date objects. * * If the `value` is null or undefined, null is returned. * If the `value` is an array of `Date` objects, a filtered array of valid `Date` objects is returned. * If the `value` is a string, it is split by commas and each part is parsed into a `Date` object. * If the parsing fails for any date, it is skipped. */ export declare function convertToDates(value?: (Date | string)[] | string | null): Date[] | null; /** * Returns the value of the selected/activated element (day/month/year) in the calendar view. */ export declare function getViewElement(event: Event): number; export declare function getWeekDayNumber(value: WeekDays): number; export declare function areSameMonth(first: DayParameter, second: DayParameter): boolean; export declare function isNextMonth(target: DayParameter, origin: DayParameter): boolean; export declare function isPreviousMonth(target: DayParameter, origin: DayParameter): boolean; /** * Returns a generator yielding day values between `start` and `end` (non-inclusive) * by a given `unit` as a step. * * @remarks * By default, `unit` is set to 'day'. */ export declare function calendarRange(options: CalendarRangeParams): Generator<CalendarDay, void, unknown>; export declare function generateMonth(value: DayParameter, firstWeekDay: number): Generator<CalendarDay, void, unknown>; export declare function getYearRange(current: DayParameter, range: number): { start: number; end: number; }; export declare function isDateInRanges(date: DayParameter, ranges: DateRangeDescriptor[]): boolean;