iainbeeston/nickel — pull request #23 by tatey (2014-07-15 08:14:04+00:00)
Title: ActiveSupport::TimeWithZone compatbility

This patch relaxes the type checking when parsing an explicit time object to Nickel. If that time object happens to be an instance of `ActiveSupport::TimeWithZone` then nickel parses the query string instead of blowing up.

Without the patch.

``` ruby
require 'nickel'
require 'active_support/time'
Time.zone = 'Sydney'
Nickel::InvalidDateTimeError: Nickel::InvalidDateTimeError
from /Users/Tate/Desktop/nickel-0.1.5/lib/nickel/nlp.rb:15:in `initialize'
from /Users/Tate/Desktop/nickel-0.1.5/lib/nickel.rb:13:in `new'
from /Users/Tate/Desktop/nickel-0.1.5/lib/nickel.rb:13:in `parse'
from (irb):11
from /Users/Tate/.homebrew/opt/rbenv/versions/2.1.2/bin/irb:11:in `

'
```

With the patch.

``` ruby
require 'nickel'
require 'active_support/time'
Time.zone = 'Sydney'
Nickel.parse('6pm tomorrow', Time.current) # => message: "", occurrences: [#]
```

We need this patch because our client posts to the server with a UNIX timestamp (Eg: `1405065600`) and timezone (Eg: `"Sydney"`) for each request.