Bug #8454

Date and Time compatibility

Added by Jonatan Hejzlar over 2 years ago. Updated over 2 years ago.

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

Description

Time.to_datetime creates a DateTime object with the local timezone
Date.to_datetime creates a DateTime object with the +0000 timezone

As a result, Date.to_time.to_datetime gives a different result than Date.to_datetime.

History

#1 Updated by tadayoshi funaba over 2 years 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