Project

General

Profile

Bug #13193

[DOC] Revise docs for Date and DateTime

Added by stomar (Marcus Stollsteimer) about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0p0 (2016-12-24 revision 57164) [i686-linux]
[ruby-core:79433]

Description

ext/date/date_core.c: [DOC] revise docs for Date and DateTime

* fix malformed rdoc for Date#today, Date._strptime,
  and DateTime._strptime
* add code examples for Date#<< and Date#>> to demonstrate
  that different dates can result in the same return value
* use Date::ITALY in call-seq instead of only ITALY
* fix some copy/paste mistakes where Date should be DateTime
* fix various errors and grammar
* fix cross references and formatting

Files

doc_date_datetime.patch (34.1 KB) doc_date_datetime.patch stomar (Marcus Stollsteimer), 02/05/2017 09:50 AM

Associated revisions

Revision bcad5a51
Added by nobu (Nobuyoshi Nakada) about 2 years ago

date_core.c: [DOC] revise docs [ci skip]

  • fix malformed rdoc for Date#today, Date._strptime, and DateTime._strptime
  • add code examples for Date#<< and Date#>> to demonstrate that different dates can result in the same return value
  • use Date::ITALY in call-seq instead of only ITALY
  • fix some copy/paste mistakes where Date should be DateTime
  • fix various errors and grammar
  • fix cross references and formatting

[ruby-core:79433] [Bug #13193]
Author: Marcus Stollsteimer sto.mar@web.de

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 57549
Added by nobu (Nobuyoshi Nakada) about 2 years ago

date_core.c: [DOC] revise docs [ci skip]

  • fix malformed rdoc for Date#today, Date._strptime, and DateTime._strptime
  • add code examples for Date#<< and Date#>> to demonstrate that different dates can result in the same return value
  • use Date::ITALY in call-seq instead of only ITALY
  • fix some copy/paste mistakes where Date should be DateTime
  • fix various errors and grammar
  • fix cross references and formatting

[ruby-core:79433] [Bug #13193]
Author: Marcus Stollsteimer sto.mar@web.de

Revision 57549
Added by nobu (Nobuyoshi Nakada) about 2 years ago

date_core.c: [DOC] revise docs [ci skip]

  • fix malformed rdoc for Date#today, Date._strptime, and DateTime._strptime
  • add code examples for Date#<< and Date#>> to demonstrate that different dates can result in the same return value
  • use Date::ITALY in call-seq instead of only ITALY
  • fix some copy/paste mistakes where Date should be DateTime
  • fix various errors and grammar
  • fix cross references and formatting

[ruby-core:79433] [Bug #13193]
Author: Marcus Stollsteimer sto.mar@web.de

Revision 57549
Added by nobu (Nobuyoshi Nakada) about 2 years ago

date_core.c: [DOC] revise docs [ci skip]

  • fix malformed rdoc for Date#today, Date._strptime, and DateTime._strptime
  • add code examples for Date#<< and Date#>> to demonstrate that different dates can result in the same return value
  • use Date::ITALY in call-seq instead of only ITALY
  • fix some copy/paste mistakes where Date should be DateTime
  • fix various errors and grammar
  • fix cross references and formatting

[ruby-core:79433] [Bug #13193]
Author: Marcus Stollsteimer sto.mar@web.de

Revision 22183166
Added by naruse (Yui NARUSE) about 2 years ago

merge revision(s) 57549: [Backport #13193]

date_core.c: [DOC] revise docs [ci skip]

* fix malformed rdoc for Date#today, Date._strptime,
  and DateTime._strptime
* add code examples for Date#<< and Date#>> to demonstrate
  that different dates can result in the same return value
* use Date::ITALY in call-seq instead of only ITALY
* fix some copy/paste mistakes where Date should be DateTime
* fix various errors and grammar
* fix cross references and formatting

[ruby-core:79433] [Bug #13193]
Author:    Marcus Stollsteimer <sto.mar@web.de>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 57904
Added by naruse (Yui NARUSE) about 2 years ago

merge revision(s) 57549: [Backport #13193]

date_core.c: [DOC] revise docs [ci skip]

* fix malformed rdoc for Date#today, Date._strptime,
  and DateTime._strptime
* add code examples for Date#<< and Date#>> to demonstrate
  that different dates can result in the same return value
* use Date::ITALY in call-seq instead of only ITALY
* fix some copy/paste mistakes where Date should be DateTime
* fix various errors and grammar
* fix cross references and formatting

[ruby-core:79433] [Bug #13193]
Author:    Marcus Stollsteimer <sto.mar@web.de>

Revision 33581853
Added by usa (Usaku NAKAMURA) about 2 years ago

merge revision(s) 57549: [Backport #13193]

date_core.c: [DOC] revise docs [ci skip]

* fix malformed rdoc for Date#today, Date._strptime,
  and DateTime._strptime
* add code examples for Date#<< and Date#>> to demonstrate
  that different dates can result in the same return value
* use Date::ITALY in call-seq instead of only ITALY
* fix some copy/paste mistakes where Date should be DateTime
* fix various errors and grammar
* fix cross references and formatting

[ruby-core:79433] [Bug #13193]
Author:    Marcus Stollsteimer <sto.mar@web.de>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 58101
Added by usa (Usaku NAKAMURA) about 2 years ago

merge revision(s) 57549: [Backport #13193]

date_core.c: [DOC] revise docs [ci skip]

* fix malformed rdoc for Date#today, Date._strptime,
  and DateTime._strptime
* add code examples for Date#<< and Date#>> to demonstrate
  that different dates can result in the same return value
* use Date::ITALY in call-seq instead of only ITALY
* fix some copy/paste mistakes where Date should be DateTime
* fix various errors and grammar
* fix cross references and formatting

[ruby-core:79433] [Bug #13193]
Author:    Marcus Stollsteimer <sto.mar@web.de>

History

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

Thank you for the great contribution.
Just curious what differs in examples of Jan 30 and Jan 31.

+ *    Date.new(2001,1,30) >>  1   #=> #<Date: 2001-02-28 ...>
+ *    Date.new(2001,1,31) >>  1   #=> #<Date: 2001-02-28 ...>

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

To "demonstrate that different dates can result in the same return value", isn't Date.new(2001,1,28) better?

#3

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

  • Status changed from Open to Closed

Applied in changeset r57549.


date_core.c: [DOC] revise docs [ci skip]

  • fix malformed rdoc for Date#today, Date._strptime, and DateTime._strptime
  • add code examples for Date#<< and Date#>> to demonstrate that different dates can result in the same return value
  • use Date::ITALY in call-seq instead of only ITALY
  • fix some copy/paste mistakes where Date should be DateTime
  • fix various errors and grammar
  • fix cross references and formatting

[ruby-core:79433] [Bug #13193]
Author: Marcus Stollsteimer sto.mar@web.de

Updated by stomar (Marcus Stollsteimer) about 2 years ago

Nobuyoshi Nakada wrote:

To "demonstrate that different dates can result in the same return value", isn't Date.new(2001,1,28) better?

Agreed.
Maybe there even should be an extra paragraph that explicitly points this out.

And maybe also the following, possibly surprising sort of behavior should be mentioned:

require "date"

date = Date.new(2001,1,31)
12.times { date >>= 1 }
date.to_s   # => "2002-01-28"

date = Date.new(2001,1,31)
date >>= 12
date.to_s   # => "2002-01-31"

Should I prepare a patch?

Updated by stomar (Marcus Stollsteimer) about 2 years ago

A shorter version:

Date.new(2001,1,31) >> 2        # => #<Date: 2001-03-31 ...>
Date.new(2001,1,31) >> 1 >> 1   # => #<Date: 2001-03-28 ...>

Update: See #13225.

Updated by naruse (Yui NARUSE) about 2 years ago

  • Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: DONE

ruby_2_4 r57904 merged revision(s) 57549.

Updated by nagachika (Tomoyuki Chikanaga) about 2 years ago

  • Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: DONE to 2.2: REQUIRED, 2.3: REQUIRED, 2.4: DONE

Updated by usa (Usaku NAKAMURA) about 2 years ago

  • Backport changed from 2.2: REQUIRED, 2.3: REQUIRED, 2.4: DONE to 2.2: DONE, 2.3: REQUIRED, 2.4: DONE

ruby_2_2 r58101 merged revision(s) 57549.

Also available in: Atom PDF