* [ruby-core:91842] [Ruby trunk Feature#15668] stdlib: Date - Time should return the difference in days
[not found] <redmine.issue-15668.20190315014101@ruby-lang.org>
@ 2019-03-15 1:41 ` foonlyboy
2019-03-15 7:09 ` [ruby-core:91845] " shevegen
1 sibling, 0 replies; 2+ messages in thread
From: foonlyboy @ 2019-03-15 1:41 UTC (permalink / raw)
To: ruby-core
Issue #15668 has been reported by foonlyboy (Eike Dierks).
----------------------------------------
Feature #15668: stdlib: Date - Time should return the difference in days
https://bugs.ruby-lang.org/issues/15668
* Author: foonlyboy (Eike Dierks)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Hi at the ruby/stdlib,
Computing with times and dates is very complicated.
There are so many pitfalls lurking there.
I stumbled about a seemingly simple computation,
involving Date and Time
try:
Date.today - Time.now
=> TypeError: expected numeric
while my naively expected result can done by:
Date.today - Time.now.to_date
=> (0/1)
There must be a whole lot of good reasons why Date - Time is not allowed.
I'd like to suggest:
- improve the error message
- improve the documentation of #-
For the error message:
TypeError: expected numeric
should be improved to:
Date - Time is not allowed
The documentation of Date should state why this is so problematic.
You might even want to add a principal documentation,
about the handling of Date and Time in ruby
---
you can't tune a fish
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* [ruby-core:91845] [Ruby trunk Feature#15668] stdlib: Date - Time should return the difference in days
[not found] <redmine.issue-15668.20190315014101@ruby-lang.org>
2019-03-15 1:41 ` [ruby-core:91842] [Ruby trunk Feature#15668] stdlib: Date - Time should return the difference in days foonlyboy
@ 2019-03-15 7:09 ` shevegen
1 sibling, 0 replies; 2+ messages in thread
From: shevegen @ 2019-03-15 7:09 UTC (permalink / raw)
To: ruby-core
Issue #15668 has been updated by shevegen (Robert A. Heiler).
The error message could indeed be improved.
As for the functionality, I think matz may have to decide whether this
may fit to duck typing or not. In my opinion the distinction between
a "date" and a "time" is a bit arbitrary when we think of time as something
keeping track of seconds (and date ultimately the same, just with some
more date-specific handling of code; oddly enough I personally almost
always end up with Time, rather than Date ... but we also have DateTime
which is even stranger).
----------------------------------------
Feature #15668: stdlib: Date - Time should return the difference in days
https://bugs.ruby-lang.org/issues/15668#change-77115
* Author: foonlyboy (Eike Dierks)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Hi at the ruby/stdlib,
Computing with times and dates is very complicated.
There are so many pitfalls lurking there.
I stumbled about a seemingly simple computation,
involving Date and Time
try:
Date.today - Time.now
=> TypeError: expected numeric
while my naively expected result can done by:
Date.today - Time.now.to_date
=> (0/1)
There must be a whole lot of good reasons why Date - Time is not allowed.
I'd like to suggest:
- improve the error message
- improve the documentation of #-
For the error message:
TypeError: expected numeric
should be improved to:
Date - Time is not allowed
The documentation of Date should state why this is so problematic.
You might even want to add a principal documentation,
about the handling of Date and Time in ruby
---
you can't tune a fish
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-15 7:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-15668.20190315014101@ruby-lang.org>
2019-03-15 1:41 ` [ruby-core:91842] [Ruby trunk Feature#15668] stdlib: Date - Time should return the difference in days foonlyboy
2019-03-15 7:09 ` [ruby-core:91845] " shevegen
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).