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

    Function isValidNic

    • Checks whether an input string is a valid Sri Lankan NIC (old or new format).

      Parameters

      • nic: unknown

        NIC number, old (9 digits + V/X) or new (12 digits). Strings and finite numbers are accepted; other types return a failure without throwing.

      • Optionaloptions: NicOptions

        Optional { referenceDate } used for age and future-date checks. Defaults to today.

      Returns boolean

      true for a valid old- or new-format NIC, otherwise false.

      isValidNic('921234567V'); // true
      isValidNic('199212304567'); // true
      isValidNic('9212345678'); // false