Skip to content

Releases: code-obos/public-frontend-modules

@obosbbl/[email protected]

14 Apr 11:14
68c5996
Compare
Choose a tag to compare

Patch Changes

  • bb45e14: add method no/validateAccountNumber()

    Validates that the input is a valid Norwegian bank account number.

        import { validateAccountNumber } from "@obosbbl/validation/no";
    
        validateAccountNumber('12345678903') // => true
    
    

@obosbbl/[email protected]

06 Mar 11:26
904a69f
Compare
Choose a tag to compare

Minor Changes

  • 1dfc896: add method no/validateNationalIdentityNumber()

    Validates that the input is a valid Norwegian national identity number (either a fødselsnummer or a D-nummer).
    It validates the checksum and checks if the date of birth is valid.

    import { validateNationalIdentityNumber } from "@obosbbl/validation/no";
    
    // Fødselsnummer
    validatePersonalIdentityNumber('21075417753') // => true
    
    // D-nummer
    validatePersonalIdentityNumber('53097248016') // => true
    
  • 2491f32: add method se/validateNationalIdentityNumber()

    Validates that the input is a valid Swedish national identity number (either a personnummer or a samordningsnummer).
    It validates the checksum and checks if the date of birth is valid.

    It supports both short (10 digits) and long (12 digits) formats, with a separator if the allowFormatting option is set to true.

    import { validateNationalIdentityNumber } from "@obosbbl/validation/se";
    
    // short
    validatePersonalIdentityNumber('YYMMDDXXXX') // true
    
    // short with separator
    validatePersonalIdentityNumber('YYMMDD-XXXX', { allowFormatting: true }) // true
    
    // long
    validatePersonalIdentityNumber('YYYYMMDDXXXX') // true
    
    // long input, validate short format
    validatePersonalIdentityNumber('YYYYMMDDXXXX', { format: 'short' }) // false
    

Patch Changes

  • b1c13ed: add checksum validation of Swedish organization numbers. Previously we only checked the length of the number.

@obosbbl/[email protected]

22 Feb 09:12
17ee316
Compare
Choose a tag to compare

Patch Changes

  • 2cfe3be: fix formatting of Swedish phone numbers that start with the area code 010

    Previously it didn't recognize 010 as a 3 digit area code, so the format would be wrong.

    // before
    formatPhoneNumber("010-1234567"); // -> 0101-23 45 67
    // after
    formatPhoneNumber("010-1234567"); // -> 010-123 45 67

@obosbbl/[email protected]

20 Feb 09:39
a4a7471
Compare
Choose a tag to compare

Patch Changes

  • 3a52b13: allow country code for phone number input in formatPhoneNumber().

    Previously it was unable to format phone numbers with country codes (+47, +46), now it can.
    Note that the country code will not be part of the formatted output.

    // 🇳🇴 example
    formatPhoneNumber("+4700000000"); // => '00 00 00 00'
    
    // 🇸🇪 example
    formatPhoneNumber("+46303123456"); // => '0303-12 34 56'

@obosbbl/[email protected]

13 Feb 13:54
30bdd44
Compare
Choose a tag to compare

Minor Changes

  • b444dd8: add method validateObosMembershipNumber() to validate if the input value is a valid OBOS membership number.

@obosbbl/[email protected]

10 Feb 18:33
0e1e89f
Compare
Choose a tag to compare

Minor Changes

@obosbbl/[email protected]

28 Jan 12:23
96a18f5
Compare
Choose a tag to compare

Minor Changes

  • a92336d: add default entrypoint for formatting functions.

    This makes it easier to support both Norwegian and Swedish formatting in the same project,
    but it requires you to specify the wanted locale as an options argument to the method.

    Example:

    // Combined 🇳🇴🇸🇪 example
    import { formatOrganizationNumber } from "@obosbbl/format";
    formatOrganizationNumber("000000000", { locale: "no" }); // => '000 000 000'
    formatOrganizationNumber("0000000000", { locale: "se" }); // => '000000-0000'
    
    // 🇳🇴 only example
    import { formatOrganizationNumber } from "@obosbbl/format/no";
    formatOrganizationNumber("000000000"); // => '000 000 000'
    
    // 🇸🇪 only example
    import { formatOrganizationNumber } from "@obosbbl/format/se";
    formatOrganizationNumber("0000000000"); // => '000000-0000'

@obosbbl/[email protected]

28 Jan 11:28
e829c50
Compare
Choose a tag to compare

Minor Changes

  • c856db7: add formatPostalCode method.

    import { formatPostalCode } from "@obosbbl/format/no";
    
    formatPostalCode("0000"); // => '0000'
    
    import { formatPostalCode } from "@obosbbl/format/se";
    
    formatPhoneNumber("00000"); // => '000 00'

Patch Changes

  • 21a8fb3: add keywords to package.json

@obosbbl/[email protected]

28 Jan 10:47
1509de3
Compare
Choose a tag to compare

Minor Changes