UNPKG

@ppasmik/birth-number-utils

Version:

A TypeScript/JavaScript library for generating, validating, and parsing Czech and Slovak birth numbers (rodné číslo).

45 lines (40 loc) 1.45 kB
declare class BirthNumber { private readonly rawValue; private readonly parsedValue; constructor(value: string); year(): number | null; month(): number | null; day(): number | null; isBorn(): boolean; isMale(): boolean; isFemale(): boolean; birthDate(): Date | null; birthDateAsString(): string | null; isValid(): boolean; isPossible(): boolean; age(): number | null; isAdult(minimumAge?: number): boolean; error(): string | null; } declare const rodnecislo: (value: string) => BirthNumber; interface BirthNumberOptions { gender?: 'MALE' | 'FEMALE'; birthDate?: Date | string; } declare const generateBirthNumber: (options?: BirthNumberOptions) => string; declare const generateCzechBirthNumber: (options?: BirthNumberOptions) => string; declare const generateSlovakBirthNumber: (options?: BirthNumberOptions) => string; type Gender = 'MALE' | 'FEMALE'; interface BirthNumberDetails { birthDate: Date; gender: Gender; age: number; isAdult: boolean; isMale: boolean; isFemale: boolean; birthDateAsString: string; error: string | null; } declare const parseBirthNumber: (birthNumber: string) => BirthNumberDetails | false; declare const isValidBirthNumber: (birthNumber: string) => boolean; export { BirthNumber, generateBirthNumber, generateCzechBirthNumber, generateSlovakBirthNumber, isValidBirthNumber, parseBirthNumber, rodnecislo };