Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

NoMethodError: undefined method `offset' for #<Chronic::RepeaterTime:0x101d00d48> #86

Closed
ottumm opened this Issue · 5 comments

2 participants

@ottumm

Executing

Chronic.parse("Serving you in Brisbane, 8000 Marina Blvd, 11:30", {:now => Time.parse("Wed Feb 15 09:32:18 -0800 2012"), :ambiguous_time_range => 10})

yields

NoMethodError: undefined method `offset' for #<Chronic::RepeaterTime:0x101d00d48>
    from /Library/Ruby/Gems/1.8/gems/chronic-0.6.7/lib/chronic/handlers.rb:321:in `handle_srp'
    from /Library/Ruby/Gems/1.8/gems/chronic-0.6.7/lib/chronic/handlers.rb:329:in `handle_s_r_p'
    from /Library/Ruby/Gems/1.8/gems/chronic-0.6.7/lib/chronic/handlers.rb:335:in `handle_p_s_r'
    from /Library/Ruby/Gems/1.8/gems/chronic-0.6.7/lib/chronic/handler.rb:70:in `send'
    from /Library/Ruby/Gems/1.8/gems/chronic-0.6.7/lib/chronic/handler.rb:70:in `invoke'
    from /Library/Ruby/Gems/1.8/gems/chronic-0.6.7/lib/chronic/chronic.rb:309:in `tokens_to_span'
    from /Library/Ruby/Gems/1.8/gems/chronic-0.6.7/lib/chronic/chronic.rb:306:in `each'
    from /Library/Ruby/Gems/1.8/gems/chronic-0.6.7/lib/chronic/chronic.rb:306:in `tokens_to_span'
    from /Library/Ruby/Gems/1.8/gems/chronic-0.6.7/lib/chronic/chronic.rb:83:in `parse'
@ottumm

I tried to find a smaller reproducible case, but removing almost anything gets rid of the error.

@leejarvis
Collaborator

There's not really much way to get around this. Chronic isn't built for extracting times, but rather parsing them. That is, Chronic expects something which represents a string that should return a new Time object. Your time should first be extracted from your string before it's sent to Chronic.

@leejarvis leejarvis closed this
@ottumm
@leejarvis
Collaborator
@ottumm

Oh, awesome! I missed the commit above, thanks for fixing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.