ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:68775] [Ruby trunk - Bug #11037] [Open] Time Parse Documentation Incorrect - Undefined method getlocal
       [not found] <redmine.issue-11037.20150407065950@ruby-lang.org>
@ 2015-04-07  6:59 ` cfis
  2015-07-05  5:58 ` [ruby-core:69876] [Ruby trunk - Bug #11037] " yasuhiro6194
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: cfis @ 2015-04-07  6:59 UTC (permalink / raw)
  To: ruby-core

Issue #11037 has been reported by Charlie Savage.

----------------------------------------
Bug #11037: Time Parse Documentation Incorrect - Undefined method getlocal
https://bugs.ruby-lang.org/issues/11037

* Author: Charlie Savage
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x64-mingw32]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
According to:

http://ruby-doc.org/stdlib-2.2.1/libdoc/time/rdoc/Time.html

Time#parse can take a 2nd parameter:

> We can change the date used to infer our missing elements by passing a second object that responds to mon, day and year, such as Date, Time or DateTime. We can also use our own object.

However, that is not correct:

<pre>
irb(main):010:0> Time.parse('12:30 AM', Date.today)
NoMethodError: undefined method `getlocal' for #<Date: 2015-04-07 ((2457120j,0s,0n),+0s,2299161j)>
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:262:in `make_time'
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:364:in `parse'
        from (irb):10
        from C:/mingw64/mingw64/local/ruby/bin/irb:11:in `<main>'
</pre>

The problem is in Time#make_time, lines 259 through 263:

<pre>
  if off
    now = now.getlocal(off) if now.utc_offset != off
  else
    now = now.getlocal
  end
</pre>

The behavior the documentation does seem desirable, so the code above should check if the now parameter responds to getlocal or not (only Time does, Date and DateTime do not).  Or of course the documentation should be updated to specify that a time object must be passed as the now parameter.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ruby-core:69876] [Ruby trunk - Bug #11037] Time Parse Documentation Incorrect - Undefined method getlocal
       [not found] <redmine.issue-11037.20150407065950@ruby-lang.org>
  2015-04-07  6:59 ` [ruby-core:68775] [Ruby trunk - Bug #11037] [Open] Time Parse Documentation Incorrect - Undefined method getlocal cfis
@ 2015-07-05  5:58 ` yasuhiro6194
  2015-08-20  5:33 ` [ruby-core:70469] " nobu
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: yasuhiro6194 @ 2015-07-05  5:58 UTC (permalink / raw)
  To: ruby-core

Issue #11037 has been updated by Yasuhiro NAKAMURA.

File time_parse.patch added

Hi,

I think it is useful Time.parse specifications on the document.
This patch is fix operation to along specifications.

----------------------------------------
Bug #11037: Time Parse Documentation Incorrect - Undefined method getlocal
https://bugs.ruby-lang.org/issues/11037#change-53291

* Author: Charlie Savage
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x64-mingw32]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
According to:

http://ruby-doc.org/stdlib-2.2.1/libdoc/time/rdoc/Time.html

Time#parse can take a 2nd parameter:

> We can change the date used to infer our missing elements by passing a second object that responds to mon, day and year, such as Date, Time or DateTime. We can also use our own object.

However, that is not correct:

<pre>
irb(main):010:0> Time.parse('12:30 AM', Date.today)
NoMethodError: undefined method `getlocal' for #<Date: 2015-04-07 ((2457120j,0s,0n),+0s,2299161j)>
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:262:in `make_time'
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:364:in `parse'
        from (irb):10
        from C:/mingw64/mingw64/local/ruby/bin/irb:11:in `<main>'
</pre>

The problem is in Time#make_time, lines 259 through 263:

<pre>
  if off
    now = now.getlocal(off) if now.utc_offset != off
  else
    now = now.getlocal
  end
</pre>

The behavior the documentation does seem desirable, so the code above should check if the now parameter responds to getlocal or not (only Time does, Date and DateTime do not).  Or of course the documentation should be updated to specify that a time object must be passed as the now parameter.

---Files--------------------------------
time_parse.patch (1.3 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ruby-core:70469] [Ruby trunk - Bug #11037] Time Parse Documentation Incorrect - Undefined method getlocal
       [not found] <redmine.issue-11037.20150407065950@ruby-lang.org>
  2015-04-07  6:59 ` [ruby-core:68775] [Ruby trunk - Bug #11037] [Open] Time Parse Documentation Incorrect - Undefined method getlocal cfis
  2015-07-05  5:58 ` [ruby-core:69876] [Ruby trunk - Bug #11037] " yasuhiro6194
@ 2015-08-20  5:33 ` nobu
  2015-08-20  5:35 ` [ruby-core:70470] " nobu
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: nobu @ 2015-08-20  5:33 UTC (permalink / raw)
  To: ruby-core

Issue #11037 has been updated by Nobuyoshi Nakada.


~~~ruby
    md = MyDate.new(28, 10, 2010)
~~~

I don't believe that 2010/28/10 is a valid date.

----------------------------------------
Bug #11037: Time Parse Documentation Incorrect - Undefined method getlocal
https://bugs.ruby-lang.org/issues/11037#change-53873

* Author: Charlie Savage
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x64-mingw32]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
According to:

http://ruby-doc.org/stdlib-2.2.1/libdoc/time/rdoc/Time.html

Time#parse can take a 2nd parameter:

> We can change the date used to infer our missing elements by passing a second object that responds to mon, day and year, such as Date, Time or DateTime. We can also use our own object.

However, that is not correct:

<pre>
irb(main):010:0> Time.parse('12:30 AM', Date.today)
NoMethodError: undefined method `getlocal' for #<Date: 2015-04-07 ((2457120j,0s,0n),+0s,2299161j)>
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:262:in `make_time'
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:364:in `parse'
        from (irb):10
        from C:/mingw64/mingw64/local/ruby/bin/irb:11:in `<main>'
</pre>

The problem is in Time#make_time, lines 259 through 263:

<pre>
  if off
    now = now.getlocal(off) if now.utc_offset != off
  else
    now = now.getlocal
  end
</pre>

The behavior the documentation does seem desirable, so the code above should check if the now parameter responds to getlocal or not (only Time does, Date and DateTime do not).  Or of course the documentation should be updated to specify that a time object must be passed as the now parameter.

---Files--------------------------------
time_parse.patch (1.3 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ruby-core:70470] [Ruby trunk - Bug #11037] Time Parse Documentation Incorrect - Undefined method getlocal
       [not found] <redmine.issue-11037.20150407065950@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2015-08-20  5:33 ` [ruby-core:70469] " nobu
@ 2015-08-20  5:35 ` nobu
  2015-08-20  5:47 ` [ruby-core:70471] " yasuhiro6194
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: nobu @ 2015-08-20  5:35 UTC (permalink / raw)
  To: ruby-core

Issue #11037 has been updated by Nobuyoshi Nakada.

Description updated

----------------------------------------
Bug #11037: Time Parse Documentation Incorrect - Undefined method getlocal
https://bugs.ruby-lang.org/issues/11037#change-53874

* Author: Charlie Savage
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x64-mingw32]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
According to:

http://ruby-doc.org/stdlib-2.2.1/libdoc/time/rdoc/Time.html

`Time#parse` can take a 2nd parameter:

> We can change the date used to infer our missing elements by passing a second object that responds to mon, day and year, such as `Date`, `Time` or `DateTime`. We can also use our own object.

However, that is not correct:

~~~ruby
irb(main):010:0> Time.parse('12:30 AM', Date.today)
NoMethodError: undefined method `getlocal' for #<Date: 2015-04-07 ((2457120j,0s,0n),+0s,2299161j)>
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:262:in `make_time'
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:364:in `parse'
        from (irb):10
        from C:/mingw64/mingw64/local/ruby/bin/irb:11:in `<main>'
~~~

The problem is in `Time#make_time`, lines 259 through 263:

~~~ruby
  if off
    now = now.getlocal(off) if now.utc_offset != off
  else
    now = now.getlocal
  end
~~~

The behavior the documentation does seem desirable, so the code above should check if the now parameter responds to `getlocal` or not (only `Time` does, `Date` and `DateTime` do not).  Or of course the documentation should be updated to specify that a time object must be passed as the now parameter.

---Files--------------------------------
time_parse.patch (1.3 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ruby-core:70471] [Ruby trunk - Bug #11037] Time Parse Documentation Incorrect - Undefined method getlocal
       [not found] <redmine.issue-11037.20150407065950@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2015-08-20  5:35 ` [ruby-core:70470] " nobu
@ 2015-08-20  5:47 ` yasuhiro6194
  2015-09-06  2:12 ` [ruby-core:70672] " yasuhiro6194
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: yasuhiro6194 @ 2015-08-20  5:47 UTC (permalink / raw)
  To: ruby-core

Issue #11037 has been updated by Yasuhiro NAKAMURA.

File time_parse.patch added

Sory my careless mistake. 
I correct mistake in test case.

----------------------------------------
Bug #11037: Time Parse Documentation Incorrect - Undefined method getlocal
https://bugs.ruby-lang.org/issues/11037#change-53875

* Author: Charlie Savage
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x64-mingw32]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
According to:

http://ruby-doc.org/stdlib-2.2.1/libdoc/time/rdoc/Time.html

`Time#parse` can take a 2nd parameter:

> We can change the date used to infer our missing elements by passing a second object that responds to mon, day and year, such as `Date`, `Time` or `DateTime`. We can also use our own object.

However, that is not correct:

~~~ruby
irb(main):010:0> Time.parse('12:30 AM', Date.today)
NoMethodError: undefined method `getlocal' for #<Date: 2015-04-07 ((2457120j,0s,0n),+0s,2299161j)>
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:262:in `make_time'
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:364:in `parse'
        from (irb):10
        from C:/mingw64/mingw64/local/ruby/bin/irb:11:in `<main>'
~~~

The problem is in `Time#make_time`, lines 259 through 263:

~~~ruby
  if off
    now = now.getlocal(off) if now.utc_offset != off
  else
    now = now.getlocal
  end
~~~

The behavior the documentation does seem desirable, so the code above should check if the now parameter responds to `getlocal` or not (only `Time` does, `Date` and `DateTime` do not).  Or of course the documentation should be updated to specify that a time object must be passed as the now parameter.

---Files--------------------------------
time_parse.patch (1.3 KB)
time_parse.patch (1.3 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ruby-core:70672] [Ruby trunk - Bug #11037] Time Parse Documentation Incorrect - Undefined method getlocal
       [not found] <redmine.issue-11037.20150407065950@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2015-08-20  5:47 ` [ruby-core:70471] " yasuhiro6194
@ 2015-09-06  2:12 ` yasuhiro6194
  2015-09-07  0:59 ` [ruby-core:70673] [Ruby trunk - Bug #11037] [Assigned] " shibata.hiroshi
  2018-10-08 12:41 ` [ruby-core:89314] [Ruby trunk Bug#11037] " citrusmoose
  7 siblings, 0 replies; 8+ messages in thread
From: yasuhiro6194 @ 2015-09-06  2:12 UTC (permalink / raw)
  To: ruby-core

Issue #11037 has been updated by Yasuhiro NAKAMURA.

File time_parse.patch added

The new patch has passed tests.
Could you review the patch again?

----------------------------------------
Bug #11037: Time Parse Documentation Incorrect - Undefined method getlocal
https://bugs.ruby-lang.org/issues/11037#change-54066

* Author: Charlie Savage
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x64-mingw32]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
According to:

http://ruby-doc.org/stdlib-2.2.1/libdoc/time/rdoc/Time.html

`Time#parse` can take a 2nd parameter:

> We can change the date used to infer our missing elements by passing a second object that responds to mon, day and year, such as `Date`, `Time` or `DateTime`. We can also use our own object.

However, that is not correct:

~~~ruby
irb(main):010:0> Time.parse('12:30 AM', Date.today)
NoMethodError: undefined method `getlocal' for #<Date: 2015-04-07 ((2457120j,0s,0n),+0s,2299161j)>
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:262:in `make_time'
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:364:in `parse'
        from (irb):10
        from C:/mingw64/mingw64/local/ruby/bin/irb:11:in `<main>'
~~~

The problem is in `Time#make_time`, lines 259 through 263:

~~~ruby
  if off
    now = now.getlocal(off) if now.utc_offset != off
  else
    now = now.getlocal
  end
~~~

The behavior the documentation does seem desirable, so the code above should check if the now parameter responds to `getlocal` or not (only `Time` does, `Date` and `DateTime` do not).  Or of course the documentation should be updated to specify that a time object must be passed as the now parameter.

---Files--------------------------------
time_parse.patch (1.3 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ruby-core:70673] [Ruby trunk - Bug #11037] [Assigned] Time Parse Documentation Incorrect - Undefined method getlocal
       [not found] <redmine.issue-11037.20150407065950@ruby-lang.org>
                   ` (5 preceding siblings ...)
  2015-09-06  2:12 ` [ruby-core:70672] " yasuhiro6194
@ 2015-09-07  0:59 ` shibata.hiroshi
  2018-10-08 12:41 ` [ruby-core:89314] [Ruby trunk Bug#11037] " citrusmoose
  7 siblings, 0 replies; 8+ messages in thread
From: shibata.hiroshi @ 2015-09-07  0:59 UTC (permalink / raw)
  To: ruby-core

Issue #11037 has been updated by Hiroshi SHIBATA.

Status changed from Open to Assigned
Assignee set to Akira Tanaka

----------------------------------------
Bug #11037: Time Parse Documentation Incorrect - Undefined method getlocal
https://bugs.ruby-lang.org/issues/11037#change-54067

* Author: Charlie Savage
* Status: Assigned
* Priority: Normal
* Assignee: Akira Tanaka
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x64-mingw32]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
According to:

http://ruby-doc.org/stdlib-2.2.1/libdoc/time/rdoc/Time.html

`Time#parse` can take a 2nd parameter:

> We can change the date used to infer our missing elements by passing a second object that responds to mon, day and year, such as `Date`, `Time` or `DateTime`. We can also use our own object.

However, that is not correct:

~~~ruby
irb(main):010:0> Time.parse('12:30 AM', Date.today)
NoMethodError: undefined method `getlocal' for #<Date: 2015-04-07 ((2457120j,0s,0n),+0s,2299161j)>
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:262:in `make_time'
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:364:in `parse'
        from (irb):10
        from C:/mingw64/mingw64/local/ruby/bin/irb:11:in `<main>'
~~~

The problem is in `Time#make_time`, lines 259 through 263:

~~~ruby
  if off
    now = now.getlocal(off) if now.utc_offset != off
  else
    now = now.getlocal
  end
~~~

The behavior the documentation does seem desirable, so the code above should check if the now parameter responds to `getlocal` or not (only `Time` does, `Date` and `DateTime` do not).  Or of course the documentation should be updated to specify that a time object must be passed as the now parameter.

---Files--------------------------------
time_parse.patch (1.3 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ruby-core:89314] [Ruby trunk Bug#11037] Time Parse Documentation Incorrect - Undefined method getlocal
       [not found] <redmine.issue-11037.20150407065950@ruby-lang.org>
                   ` (6 preceding siblings ...)
  2015-09-07  0:59 ` [ruby-core:70673] [Ruby trunk - Bug #11037] [Assigned] " shibata.hiroshi
@ 2018-10-08 12:41 ` citrusmoose
  7 siblings, 0 replies; 8+ messages in thread
From: citrusmoose @ 2018-10-08 12:41 UTC (permalink / raw)
  To: ruby-core

Issue #11037 has been updated by citrusmoose (Matt Rice).


What is the status of this?

----------------------------------------
Bug #11037: Time Parse Documentation Incorrect - Undefined method getlocal
https://bugs.ruby-lang.org/issues/11037#change-74343

* Author: cfis (Charlie Savage)
* Status: Assigned
* Priority: Normal
* Assignee: akr (Akira Tanaka)
* Target version: 
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x64-mingw32]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
According to:

http://ruby-doc.org/stdlib-2.2.1/libdoc/time/rdoc/Time.html

`Time#parse` can take a 2nd parameter:

> We can change the date used to infer our missing elements by passing a second object that responds to mon, day and year, such as `Date`, `Time` or `DateTime`. We can also use our own object.

However, that is not correct:

~~~ruby
irb(main):010:0> Time.parse('12:30 AM', Date.today)
NoMethodError: undefined method `getlocal' for #<Date: 2015-04-07 ((2457120j,0s,0n),+0s,2299161j)>
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:262:in `make_time'
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:364:in `parse'
        from (irb):10
        from C:/mingw64/mingw64/local/ruby/bin/irb:11:in `<main>'
~~~

The problem is in `Time#make_time`, lines 259 through 263:

~~~ruby
  if off
    now = now.getlocal(off) if now.utc_offset != off
  else
    now = now.getlocal
  end
~~~

The behavior the documentation does seem desirable, so the code above should check if the now parameter responds to `getlocal` or not (only `Time` does, `Date` and `DateTime` do not).  Or of course the documentation should be updated to specify that a time object must be passed as the now parameter.

---Files--------------------------------
time_parse.patch (1.3 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-10-08 12:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-11037.20150407065950@ruby-lang.org>
2015-04-07  6:59 ` [ruby-core:68775] [Ruby trunk - Bug #11037] [Open] Time Parse Documentation Incorrect - Undefined method getlocal cfis
2015-07-05  5:58 ` [ruby-core:69876] [Ruby trunk - Bug #11037] " yasuhiro6194
2015-08-20  5:33 ` [ruby-core:70469] " nobu
2015-08-20  5:35 ` [ruby-core:70470] " nobu
2015-08-20  5:47 ` [ruby-core:70471] " yasuhiro6194
2015-09-06  2:12 ` [ruby-core:70672] " yasuhiro6194
2015-09-07  0:59 ` [ruby-core:70673] [Ruby trunk - Bug #11037] [Assigned] " shibata.hiroshi
2018-10-08 12:41 ` [ruby-core:89314] [Ruby trunk Bug#11037] " citrusmoose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).