lib/swedish_pin/personnummer.rb in swedish-pin-1.1.0 vs lib/swedish_pin/personnummer.rb in swedish-pin-2.0.0

- old
+ new

@@ -42,11 +42,11 @@ # {SwedishPIN.generate} instead of you want custom instances. def initialize(year:, month:, day:, sequence_number:, control_digit:) @year = year @month = month @coordination_number = day > 60 - @day = (day > 60 ? day - 60 : day) + @day = ((day > 60) ? day - 60 : day) @sequence_number = sequence_number @control_digit = control_digit end # Return the birthday for the person that is represented by this @@ -199,9 +199,11 @@ alias_method :eql?, :== private def short_separator(now) + # Turn into `+` on the same year as the PINs 100th birthday, even before + # the actual date. if year <= (now.year - 100) "+" else "-" end