design-angular-kit-lombardia
Version:
Un toolkit Angular conforme alle linee guida di design per i servizi web della Regione Lombardia
80 lines (79 loc) • 2.47 kB
TypeScript
import { Observable } from 'rxjs';
export declare class ItDateUtils {
/**
* Add seconds to date
* @param date the date
* @param seconds seconds to add
*/
static addSeconds(date: Date, seconds: number): Date;
/**
* Add minutes to date
* @param date the date
* @param minutes minutes to add
*/
static addMinutes(date: Date, minutes: number): Date;
/**
* Add hours to date
* @param date the date
* @param hours hours to add
*/
static addHours(date: Date, hours: number): Date;
/**
* Add days to date
* @param date the date
* @param days days to add
*/
static addDays(date: Date, days: number): Date;
/**
* Add years to date
* @param date the date
* @param months months to add
*/
static addMonths(date: Date, months: number): Date;
/**
* Add years to date
* @param date the date
* @param years years to add
*/
static addYears(date: Date, years: number): Date;
/**
* Calculate number of days between two date
* @param startDate
* @param endDate
* @param absolute return unsigned result
*/
static countDays(startDate: Date, endDate: Date, absolute?: boolean): number;
/**
* Check if string is a date with iso format
* @param value the string
*/
static isIsoString(value: string | null): boolean;
/**
* Convert iso string to Date
* @param isoString the iso string
*/
static isoStringToDate(isoString: string | null): Date | null;
/**
* Remove time from an iso date string
* @param isoString the iso string
*/
static isoStringRemoveTime(isoString: string): string;
/**
* Set iso string hours to 0 and format correctly the date (consider timezone offset)
* @example '2024-03-04T23:00:00.000Z' -> '2024-03-05T00:00:00.000Z'
* @param isoString the iso string
*/
static isoStringSetZeroTime(isoString: string): string;
/**
* Calculate the date time left and return the string format [d h m s]
* @param endDate
*/
static timeLeftString(endDate: Date): Observable<string>;
/**
* Calculate the next day of week
* @param dayOfWeek Day of week 0=Sunday, 1=Monday...4=Thursday...
* @param hour the specif hour
* @param minute the specific minute
*/
static nextWeekDayAndTime(dayOfWeek: number, hour?: number, minute?: number): Date;
}