UNPKG

@edugouvfr/ngx-dsfr-ext

Version:

NgxDsfrExt est une extension au package @edugouvfr/ngx-dsfr (portage Angular des éléments DSFR)

51 lines (50 loc) 1.86 kB
/** * @author pfontanet * @since 0.9 */ import { DsfrI18nService, LoggerService } from '@edugouvfr/ngx-dsfr'; export declare class DateUtils { private constructor(); /** * Parse une chaine selon le format 'fr' si codeLang = 'fr', 'en' * @returns Date ou undefined */ static parse(codeLang: string, dateStr: string | undefined): Date | undefined; /** * Parse une chaîne au format `'mm/dd/yyyy'` (1 digit pour mois et jour accepté) * @returns Date ou undefined */ static parseDateFr(dateStr: string): Date | undefined; /** * Parse une chaîne au format `'dd/mm/yyyy'` (1 digit pour mois et jour accepté) * @returns Date ou undefined */ static parseDateEn(dateStr: string): Date | undefined; /** * Parse une chaîne au format ISO 8601 * @returns Date ou undefined */ static parseDateIso(dateStr: string): Date | undefined; /** * Retourne une Date UTC, sans heure, minute seconde, à partir d'une date * @param date */ static date2Utc(date: Date): Date; /** * Retourne une Date UTC, sans heure, minute seconde, selon plusieurs formats en entrée * @param value */ static dateUtcOf(value: Date | string | number | undefined | null): Date | undefined; static format(codeLang: string, date: Date | undefined): string; static arr(i18n: DsfrI18nService, logger: LoggerService, jsonPath: string): any[]; /** Date valide au format dd/mm/yyyy ou mm/dd/yyyy */ static isValidDefaultString(boundaryString: string): boolean; /** * Parse la date en fonction d'une expression régulière * @param dateStr String représentant la date * @param regexp * @return Date ou undefined si dateStr ne respecte pas la regexp */ private static parseDate; private static numberToDateUtc; }