@cisstech/nge
Version:
NG Essentials is a collection of libraries for Angular developers.
49 lines (48 loc) • 1.91 kB
TypeScript
export declare function epoch(): Date;
export declare function addDays(date: Date, days: number): Date;
/** Gets current value of unix timestamp */
export declare function timestamp(): number;
/**
* Gets unix timestamp value of `date`
* @param date the date.
*/
export declare function toTimestamp(date: Date): number;
/**
* Converts an unix timestamp to a Date object
* @param time an unix timestamp
*/
export declare function dateFromTimestamp(time: number): Date;
/**
* Converts an unix timestamp to a date in the format 'day month hours mins'
* @param time an unix timestamp.
* @param locale target language locale tag.
* @returns string representation of the date.
*/
export declare function fullDate(time: number, locale?: string): string;
/**
* Converts an unix timestamp to a date in the format 'day month'
* @param time an unix timestamp.
* @param locale target language locale tag.
* @returns string representation of the date.
*/
export declare function shortDate(time: number, locale?: string): string;
/**
* Converts an unix timestamp to a date in the format 'hours mins'
* @param time an unix timestamp.
* @returns string representation of the date.
*/
export declare function hours(time: number): string;
/**
* Gets a value indicating whether the timestamp is today.
* @param time an unix timestamp.
*/
export declare function isToday(time: number): boolean;
/**
* Gets a value indicating whether the given dates representes the same year, month and day.
* @param d1 the first date.
* @param d2 the second date.
*/
export declare function compareDays(d1: Date, d2: Date): boolean;
export declare function convertDate(time: number, format: Intl.DateTimeFormatOptions, locale?: string): string;
export declare function weeksDiff(d1: Date, d2: Date): number;
export declare function dateRangeOverlaps(a_start: Date, a_end: Date, b_start: Date, b_end: Date): boolean;