Skip to content

Commit

Permalink
Merge pull request #13 from mbsoftworks/expose-parts
Browse files Browse the repository at this point in the history
Expose the parts of the personal identity number
  • Loading branch information
bombsimon authored Sep 30, 2022
2 parents 35f9ac8 + 976e3cc commit ab62151
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,26 @@ impl Personnummer {
pub fn is_coordination_number(&self) -> bool {
self.coordination
}

/// Year of date of birth.
pub fn year(&self) -> i32 {
self.date.year()
}

/// Month of date of birth.
pub fn month(&self) -> u32 {
self.date.month()
}

/// Day of date of birth.
pub fn day(&self) -> u32 {
self.date.day()
}

/// Serial part of personal identity number.
pub fn serial(&self) -> u32 {
self.serial
}
}

/// Calculate the checksum based on luhn algorithm. See more information here:
Expand Down

0 comments on commit ab62151

Please sign in to comment.