Project

General

Profile

This project is closed and read-only.

Actions

Backport #8608

closed

Inconsistent parse of DateTime zone specification with seconds

Backport #8608: Inconsistent parse of DateTime zone specification with seconds

Added by teleological (Riley Lynch) about 13 years ago. Updated about 13 years ago.


Description

When a time zone specification has a single-digit hour and includes minutes and seconds without colons, the minutes offset is overwritten by the seconds offset. In this example +3:30 is incorrectly parsed as +3:00:

DateTime.parse('6 Nov 1973 18:45 +33000') # => #<DateTime: 1973-11-06T18:45:00+03:00 ((2441993j,56700s,0n),+10800s,2299161j)>

This defect is not present when the hour is specified by two digits:

DateTime.parse('7 Nov 1973 04:00 +124500') # => #<DateTime: 1973-11-07T04:00:00+12:45 ((2441993j,54900s,0n),+45900s,2299161j)>

Attached is a patch which corrects this issue.


Files

tz_sec.patch (439 Bytes) tz_sec.patch Patch for trunk@41825 (c51615963) teleological (Riley Lynch), 07/08/2013 12:31 AM

Updated by nagachika (Tomoyuki Chikanaga) about 13 years ago Actions #1 [ruby-core:55870]

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

The patch seems quite simple and reasonable.
funaba-san, could you review the patch?

Updated by tadf (tadayoshi funaba) about 13 years ago Actions #2 [ruby-core:55885]

  • Assignee changed from tadf (tadayoshi funaba) to nagachika (Tomoyuki Chikanaga)

backport r41871.

Updated by nagachika (Tomoyuki Chikanaga) about 13 years ago Actions #3

  • Tracker changed from Bug to Backport
  • Project changed from Ruby to 15
  • Category deleted (ext)

Updated by nagachika (Tomoyuki Chikanaga) about 13 years ago Actions #4

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r41951.
Riley, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 41871: [Backport #8608]

* ext/date/date_parse.c (date_zone_to_diff): [ruby-core:55831].
Actions

Also available in: PDF Atom