For people aged 100 and up, the minus/dash in the personnummer is changed to a plus, on new year's eve the year they turn 100. See Folkbokföringslagen (1991:481), §18.
For example, 121212-1212 refers to a person born 2012-12-12, whereas 121212+1212 refers to someone born 1912-12-12. One has to be careful however, since YY > current_year % 100 means the person is another 100 years old. For example, 400606+XXXX would refer to Johanna Charlotta Johansson, born 1840-06-06, died 1947-11-02. This will remain the lowest personnummer in Sweden's records until 2040.
Some other useful notes:
there are currently no living Swedes born in the 19th century
year 2047 is likely to cause some problems, since personnummer were introduced in 1947
Simply stripping + and - as the code does right now in compact() is not correct. format() is similarly incorrect.
For people aged 100 and up, the minus/dash in the personnummer is changed to a plus, on new year's eve the year they turn 100. See Folkbokföringslagen (1991:481), §18.
For example, 121212-1212 refers to a person born 2012-12-12, whereas 121212+1212 refers to someone born 1912-12-12. One has to be careful however, since YY > current_year % 100 means the person is another 100 years old. For example, 400606+XXXX would refer to Johanna Charlotta Johansson, born 1840-06-06, died 1947-11-02. This will remain the lowest personnummer in Sweden's records until 2040.
Some other useful notes:
Simply stripping + and - as the code does right now in compact() is not correct. format() is similarly incorrect.
One simple fix is to use the same logic as in formator.js (https://github.com/jop-io/formator.js)