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.

91 lines (90 loc) 3.64 kB
export declare enum FormatDesc { Numeric = "numeric", TwoDigits = "2-digit" } export declare enum DateParts { Day = "day", Month = "month", Year = "year", Date = "date", Hours = "hours", Minutes = "minutes", Seconds = "seconds", AmPm = "amPm", Literal = "literal" } export declare enum DatePart { Month = "month", Year = "year", Date = "date", Hours = "hours", Minutes = "minutes", Seconds = "seconds", AmPm = "amPm" } /** @ignore */ export interface DatePartInfo { type: DateParts; start: number; end: number; format: string; } export interface DatePartDeltas { date?: number; month?: number; year?: number; hours?: number; minutes?: number; seconds?: number; } export declare abstract class DateTimeUtil { static readonly DEFAULT_INPUT_FORMAT = "MM/dd/yyyy"; static readonly DEFAULT_TIME_INPUT_FORMAT = "hh:mm tt"; private static readonly SEPARATOR; private static readonly DEFAULT_LOCALE; private static _parser; static parseValueFromMask(inputData: string, dateTimeParts: DatePartInfo[], promptChar?: string): Date | null; static getDefaultMask(locale: string): string; static parseDateTimeFormat(mask: string, locale?: string, noLeadingZero?: boolean): DatePartInfo[]; static parseIsoDate(value: string): Date | null; static isValidDate(value: any): value is Date; static formatDate(value: Date, locale: string, format: string, noLeadingZero?: boolean): string; static getPartValue(datePartInfo: DatePartInfo, partLength: number, _dateValue: Date | null): string; static spinYear(delta: number, newDate: Date): Date; static spinMonth(delta: number, newDate: Date, spinLoop: boolean): void; static spinDate(delta: number, newDate: Date, spinLoop: boolean): void; static spinHours(delta: number, newDate: Date, spinLoop: boolean): void; static spinMinutes(delta: number, newDate: Date, spinLoop: boolean): void; static spinSeconds(delta: number, newDate: Date, spinLoop: boolean): void; static spinAmPm(newDate: Date, currentDate: Date, amPmFromMask: string): Date; static greaterThanMaxValue(value: Date, maxValue: Date, includeTime?: boolean, includeDate?: boolean): boolean; /** * Determines whether the provided value is less than the provided min value. * * @param includeTime set to false if you want to exclude time portion of the two dates * @param includeDate set to false if you want to exclude the date portion of the two dates * @returns true if provided value is less than provided minValue */ static lessThanMinValue(value: Date, minValue: Date, includeTime?: boolean, includeDate?: boolean): boolean; /** * Validates a value within a given min and max value range. * * @param value The value to validate * @param minValue The lowest possible value that `value` can take * @param maxValue The largest possible value that `value` can take */ static validateMinMax(value: Date, minValue: Date | string, maxValue: Date | string, includeTime?: boolean, includeDate?: boolean): {}; private static setDisplayFormatOptions; private static getMask; private static addCurrentPart; private static ensureLeadingZero; private static determineDatePart; private static getDefaultLocaleMask; private static fillDatePartsPositions; private static getCleanVal; private static escapeRegExp; private static trimEmptyPlaceholders; private static daysInMonth; private static prependValue; private static toTwelveHourFormat; }