Skip to content

Instantly share code, notes, and snippets.

@thatdutchguy
Created August 1, 2014 01:36
Show Gist options
  • Save thatdutchguy/2be0d51294b7ccc9bf7f to your computer and use it in GitHub Desktop.
Save thatdutchguy/2be0d51294b7ccc9bf7f to your computer and use it in GitHub Desktop.
Ruby Time.parse exception
~ » ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
~ » pry
[1] pry(main)> require 'time'
=> true
[2] pry(main)> time_string = "2013"
=> "2013"
[3] pry(main)> DateTime.parse time_string
ArgumentError: invalid date
from (pry):3:in `parse'
[4] pry(main)> Time.parse time_string
ArgumentError: argument out of range
from /Users/Daniel/.rubies/ruby-2.1.2/lib/ruby/2.1.0/time.rb:264:in `local'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment