Project

General

Profile

Actions

Bug #4975

closed

DateTime.civil calculates seconds incorrectly with fractional offsets

Added by jfelchner (Jeff Felchner) almost 13 years ago. Updated over 12 years ago.

Status:
Rejected
Target version:
-
ruby -v:
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.4]
Backport:
[ruby-core:37788]

Description

Ruby Version 1.9.2p180

DateTime.civil(2011, 5, 13, 17, 31, 13, -0.25).sec # => 12

Updated by naruse (Yui NARUSE) almost 13 years ago

  • Status changed from Open to Assigned
  • Assignee set to tadf (tadayoshi funaba)

Updated by tadf (tadayoshi funaba) over 12 years ago

  • Status changed from Assigned to Rejected
  • Priority changed from Normal to 3

The contagion of flonum affects the determination of date and time.
You may give it as a rational number or a string.

DateTime.new(2011,5,13,17,31,13,Rational('-0.25'))
#=> #<DateTime: 2011-05-13T17:31:13-06:00 (212172089473/86400,-1/4,2299161)>

DateTime.new(2011,5,13,17,31,13,Rational(-1,4))
#=> #<DateTime: 2011-05-13T17:31:13-06:00 (212172089473/86400,-1/4,2299161)>

DateTime.new(2011,5,13,17,31,13,'-06:00')
#=> #<DateTime: 2011-05-13T17:31:13-06:00 (212172089473/86400,-1/4,2299161)>

Actions

Also available in: Atom PDF

Like0
Like0Like0