Make Time#to_date compliant with MRI 1.9-2#740
Merged
headius merged 1 commit intojruby:masterfrom May 17, 2013
Merged
Conversation
Time#to_date should use the proleptic Gregorian calendar to construct a Date, but should return a Date object with the default calendar reform day. This is unlike the behavior of Ruby 1.8 Time#to_date, which was private and seems to have served as the basis for the current implementation. A specification for this method has been added to rubyspec.
Author
|
This patch was accepted by rubinius (along with a few other rubinius-specific fixes). |
Member
|
So...was this a bug in MRI's date.rb? We largely ship the same stdlib code and don't like to diverge without good reason. |
Member
|
I do see that MRI's native date ext does the GREGORIAN version too: |
headius
added a commit
that referenced
this pull request
May 17, 2013
Make Time#to_date compliant with MRI 1.9-2
Member
|
I went ahead and merged it. I think I understand that this was incorrect behavior inherited from 1.8, fixed in 1.9.2 and then ported into C for 1.9.3. Perhaps we should be incorporating 1.9.2's date.rb, if we're not already? |
headius
added a commit
to jruby/ruby
that referenced
this pull request
May 17, 2013
Author
|
The 1.9 date library is unusual in so far as it is not loaded with the core, but it has a native implementation. Is anything like that done for JRuby? Are there any core classes which are extended by native standard libraries? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Time#to_date should use the proleptic Gregorian calendar to construct a Date,
but should return a Date object with the default calendar reform day. This is
unlike the behavior of Ruby 1.8 Time#to_date, which was private and seems to
have served as the basis for the current implementation. A specification
for this method has been added to rubyspec.