Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cherry pick of Date::Calculations to Time::Calculations #4530

Closed
wants to merge 0 commits into from

Conversation

calebhearth
Copy link
Contributor

Meet dependencies by requiring active_support/core_ext/date/calculations' in Time::Calculations. Line 101 "d = to_date.advance(options)" uses Date#advance which is defined there.

@arunagw
Copy link
Member

arunagw commented Jan 26, 2012

Is there any failing test so we can check with that??

@calebhearth
Copy link
Contributor Author

No I can not, because apparently it works fine.

I am not sure why it was not working for me, nor am I sure why it does work since Date#advance is not defined in Time::Calculations and none of the requires at the top of Time::Calculations add it.

rails[master]/ › irb
>> require 'active_support/duration'
=> true
>> require 'active_support/core_ext/time/zones'
=> true
>> require 'active_support/core_ext/time/conversions'
=> true
>> Date.new.advance minutes: 1
NoMethodError: undefined method `advance' for #<Date: -4712-01-01 (-1/2,0,2299161)>
    from (irb):4
    from /home/caleb/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'
>> Time.new.to_date.advance minutes: 1
NoMethodError: undefined method `advance' for #<Date: 2012-01-26 (4911905/2,0,2299161)>
        from (irb):5
        from /home/caleb/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'

But...

rails[master]/ › irb
>> require 'active_support/core_ext/time/calculations'
=> true
>> Date.new.advance minutes: 1
=> #<Date: -4712-01-01 (-1/2,0,2299161)>

So it clearly works somehow. I'm just not sure where active_support/core_ext/date/calculations is being required, or more specifically where Date#advance is being defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants