Bug #8454

Date and Time compatibility

Added by Jonatan Hejzlar 11 months ago. Updated 11 months ago.

[ruby-core:55172]
Status:Rejected
Priority:Normal
Assignee:-
Category:ext
Target version:-
ruby -v:2.0.0p195 Backport:1.9.3: UNKNOWN, 2.0.0: UNKNOWN

Description

Time.todatetime creates a DateTime object with the local timezone
Date.to
datetime creates a DateTime object with the +0000 timezone

As a result, Date.totime.todatetime gives a different result than Date.to_datetime.

History

#1 Updated by tadayoshi funaba 11 months ago

  • Status changed from Open to Rejected

it's the current spec.
see .

i think you are interested in the following case too.

Time.parse('2001-02-03')
#=> 2001-02-03 00:00:00 +0900

Date.parse('2001-02-03')
#=> #

DateTime.parse('2001-02-03')
#=> #

i honestly don't like this feature.
but i think i just provided what users want in this case.

Also available in: Atom PDF