lanka-validations - v2.1.0
    Preparing search index...

    Function isValidDob

    • Validates whether an input is a valid Date of Birth.

      Parameters

      • input: unknown

        Date of birth in any format parseDob accepts.

      • Optionaloptions: DobOptions

        Optional { minAge, maxAge, referenceDate }.

      Returns boolean

      true if the date exists, is not in the future, and satisfies the age limits.

      isValidDob('2000-01-15', { minAge: 18, referenceDate: new Date('2026-01-01') }); // true
      isValidDob('2015-01-01', { minAge: 18, referenceDate: new Date('2026-01-01') }); // false