coersystem
Version:
Library for Angular projects
65 lines (64 loc) • 2.48 kB
TypeScript
/** Provides several methods for dates manipulation */
export declare class Dates {
private static readonly MONTHS;
/** */
static GetOffset(): number;
/** */
static GetLastDay(date: string | Date): number;
/** */
static IsValidDate(date: string | Date): boolean;
/** */
static GetCurrentDate(): Date;
/** */
private static _CleanDate;
/** */
static ToLocalZone(utcDate: string | Date): Date;
/** */
static ToUTC(date: string | Date): Date;
/** YYYY-MM-DD HH:mm:ss */
static ToFormatDB(date: string | Date): string;
/** */
static ToFormatDate(date: string | Date, format?: 'MDY' | 'DMY' | 'YMD'): string;
/** */
static ToFormatTime(date: string | Date, ampm?: boolean): string;
/** */
static ToFormatDateTime(date: string | Date, ampm?: boolean, format?: 'MDY' | 'DMY' | 'YMD'): string;
/** */
static AddMilliseconds(date: string | Date, milliseconds: number): Date;
/** */
static AddSeconds(date: string | Date, seconds?: number): Date;
/** */
static AddMinutes(date: string | Date, minutes?: number): Date;
/** */
static AddHours(date: string | Date, hours?: number): Date;
/** Add days */
static AddDays(date: string | Date, days?: number): Date;
/** Add weeks */
static AddWeeks(date: string | Date, weeks?: number): Date;
/** Add months */
static AddMonths(date: string | Date, months?: number): Date;
/** Add years */
static AddYears(date: string | Date, years?: number): Date;
/** */
static SetMillisecond(date: string | Date, millisecond?: number): Date;
/** */
static SetSecond(date: string | Date, second?: number): Date;
/** */
static SetMinute(date: string | Date, minute?: number): Date;
/** */
static SetHour(date: string | Date, hour?: number): Date;
/** Set 00:00:00 */
static SetFirstHour(date: string | Date): Date;
/** Set 23:59:59 */
static SetLastHour(date: string | Date): Date;
/** */
static SetDay(date: string | Date, day?: number): Date;
/** */
static SetFirstDay(date: string | Date): Date;
/** */
static SetLastDay(date: string | Date): Date;
/** */
static GetDiffNow(date: string | Date, unit?: 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days'): number;
/** */
static GetDiff(fromDate: string | Date, toDate: string | Date, unit?: 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days'): number;
}