Giter VIP home page Giter VIP logo

personnummer's Introduction

Personnummer

Personnummer is a ruby class that handles [Swedish personal identity number](http://en.wikipedia.org/wiki/Personal_identity_number_(Sweden\)).

Installation

$ gem install personnummer

Example usage

>> p = Personnummer.new('830428-5912')
#>>Personnummer:0x007fc971369100 @valid=true, @control_digit=2, @divider="-", @serial=591, @born=#>>PersonnummerDate:0x007fc971368318 @divider="-", @day=28, @month=4, @year=1983> #<, @region="Skaraborgs län", @female=false> #<

>> p.valid?
=> true

This implementation also supports co-ordination numbers

Information about co-ordination numbers (in swedish)

These numbers are obtained by adding 60 to the day of the birth date

>> p = Personnummer.new('830488-5912')
=> #<Personnummer:0x007fbafd1458d8 @valid=false, @control_digit=2, @divider="-", @serial=591, @born=#<PersonnummerDate:0x007fbafd144af0 @divider="-", @day=88, @month=4, @year=1983>, @region="Skaraborgs län", @female=false>
>> p.born_at
=> #<Date: 1983-04-28 ((2445453j,0s,0n),+0s,2299161j)>
>> p.co_ordination_number?
=> true

personnummer's People

Contributors

peterhellberg avatar koronen avatar wallin avatar theneubeck avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.