@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
30 lines (29 loc) • 1.33 kB
TypeScript
//#region src/utils/dates.d.ts
/** Checks if the provided value is a valid date */
declare function isValidDate(value: Date | string | number): boolean;
/** Formats the date to ISO format: 'yyyy-mm-dd' */
declare function formatIsoDate(date: Date | string | number): string | undefined;
/**
* Parses string date with the iso format of YYYY-mm-dd
* @param input string
* @returns Date | undefined
*/
declare function parseIsoDate(input?: string): Date | undefined;
/**
* Validation for 'YYYY-MM-DD' format
*/
declare function validateDateFormat(dateString: string): RegExpMatchArray | null;
declare const getDateUTCValue: (date: Date) => {
utcYear: number;
utcMonth: number;
utcDate: number;
};
declare const generateDateByUTCValue: (year: number, month: number, day?: number) => Date;
declare const sameYearSameMonth: (a?: Date, b?: Date) => boolean;
declare const sameYear: (a?: Date, b?: Date) => boolean;
declare const sameDate: (a?: Date, b?: Date) => boolean;
declare const utcDateToLocale: (utcDate?: Date) => string | undefined;
declare const getCurrentYear: () => number;
//#endregion
export { formatIsoDate, generateDateByUTCValue, getCurrentYear, getDateUTCValue, isValidDate, parseIsoDate, sameDate, sameYear, sameYearSameMonth, utcDateToLocale, validateDateFormat };
//# sourceMappingURL=dates.d.ts.map