UNPKG

gedcom-ts

Version:

TypeScript GEDCOM toolkit for browser apps: import .ged/.zip, edit typed genealogy data, and export GEDCOM or GEDZIP.

111 lines (110 loc) 4.09 kB
export declare enum TypeDateAct { BEF = "BEF", ABT = "ABT", AFT = "AFT", /** GEDCOM 5.5 / interop : date interprétée. */ INT = "INT", /** Estimée. */ EST = "EST", /** Calculée. */ CAL = "CAL", BET = "BET", FROM = "FROM", NULL = "NULL" } /** Qualificateur de date simple (hors BET/FROM). */ export type TypeDateActSimpleQualifier = TypeDateAct.BEF | TypeDateAct.ABT | TypeDateAct.AFT | TypeDateAct.INT | TypeDateAct.EST | TypeDateAct.CAL; export declare enum MonthEnum { JAN = "JAN", FEB = "FEB", MAR = "MAR", APR = "APR", MAY = "MAY", JUN = "JUN", JUL = "JUL", AUG = "AUG", SEP = "SEP", OCT = "OCT", NOV = "NOV", DEC = "DEC" } export type Day = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | null; export declare const days: number[]; export type Month = MonthEnum.JAN | MonthEnum.FEB | MonthEnum.MAR | MonthEnum.APR | MonthEnum.MAY | MonthEnum.JUN | MonthEnum.JUL | MonthEnum.AUG | MonthEnum.SEP | MonthEnum.OCT | MonthEnum.NOV | MonthEnum.DEC | null; export declare const months: Month[]; export declare class DateAct { typeDateAct?: TypeDateAct; day?: Day; month?: Month; year?: number; endDay?: Day; endMonth?: Month; endYear?: number; /** * Texte libre lié à la date : `3 PHRASE` sous `DATE` à l’import, ou fragment final `(...)` hérité 5.5. */ datePhrase?: string | null; /** `3 TIME` sous `DATE` / `SDATE` (GEDCOM 7). */ dateTime?: string | null; /** * Charge `DATE`/`SDATE` non résolvable en champs typés (URI GEDCOM 7, texte libre, combos exotiques) : * conservée telle quelle pour l’export tant qu’aucune date structurée exploitable n’est présente. */ verbatimDatePayload?: string | null; constructor(dateLine: string); private applyVerbatimFallback; /** Indique si l’on dispose d’une date structurée exportable (hors seul verbatim). */ private hasStructuredDateForExport; get date(): string | null; /** Sous-ligne `3 TIME` (import GEDCOM 7). */ setDateTimeFromImport(fragment: string): void; updateExactDate(year?: number, month?: Month, day?: Day): void; /** Ajoute du texte issu d’un `3 PHRASE` sous `DATE` (import GEDCOM 7). */ appendDatePhraseFromImport(fragment: string): void; updateQualifiedDate(typeDateAct: TypeDateActSimpleQualifier, year?: number, month?: Month, day?: Day): void; updateBetweenDates(start: { year: number; month?: Month; day?: Day; }, end: { year: number; month?: Month; day?: Day; }): void; updateFromToDates(start: { year: number; month?: Month; day?: Day; }, end: { year: number; month?: Month; day?: Day; }): void; clearDate(): void; /** * Remplace l’état de cette instance par le résultat du parseur sur une charge `DATE` / `SDATE` GEDCOM * (même logique que le constructeur), sans changer la référence d’objet — utile pour l’édition in-place. */ applyGedcomDatePayload(dateLine: string): void; private tryParseIsoYmd; /** ISO `YYYY-MM` (GEDCOM 7 : précision au mois). */ private tryParseIsoYm; /** Extrait une note finale `(...)` (style 5.5) du reste de la charge date. */ private static extractInlineParentheticalPhrase; private convertMonth; private parseSinglePart; private parseTwoParts; private parseThreeParts; private parseFourParts; private tryConsumeMonthYearSlash; private parseMonthToken; private formatCoreDate; private tryParseRangeDate; private parseCoreDateValue; private isRelativeType; private asRelativeType; /** Retire les préfixes de calendrier GEDCOM (`@#DGREGORIAN@`, … — forme `@#NAME@`). */ private stripCalendarPrefixes; isValid(): boolean; } export declare const dateToDateLine: (year?: number, month?: Month, day?: Day) => string;