https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112014-12-20T09:26:31ZRuby Issue Tracking SystemRuby master - Bug #10588: Invalid Dateshttps://redmine.ruby-lang.org/issues/10588?journal_id=505272014-12-20T09:26:31Zakr (Akira Tanaka)akr@fsij.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p>It is not good idea to restrict current methods to reject invalid dates and times.</p>
<p>I tried to verify invalid time using round trip test once.<br>
(ruby-core:14517, ruby-dev:33058, r14765, r15203)</p>
<p>But it caused bigger problems over benefits.</p>
<p>Invalid date/time is difficult to determine.<br>
It is almost impossible by application because it depends various factors:<br>
Month, leap year, summer time, leap seconds, time zone definition change.</p>
<p>Sometimes application needs a Time object near given year/month/day/hour/minute/second.<br>
It is very difficult to do using the restricted methods.</p>
<p>So, methods only accept valid dates are less useful than current methods.</p> Ruby master - Bug #10588: Invalid Dateshttps://redmine.ruby-lang.org/issues/10588?journal_id=505282014-12-20T09:27:24Zakr (Akira Tanaka)akr@fsij.org
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-6 priority-4 priority-default closed" href="/issues/9549">Feature #9549</a>: Improvements to Time::strptime</i> added</li></ul> Ruby master - Bug #10588: Invalid Dateshttps://redmine.ruby-lang.org/issues/10588?journal_id=508212015-01-07T05:58:35Zakr (Akira Tanaka)akr@fsij.org
<ul><li><strong>Has duplicate</strong> <i><a class="issue tracker-1 status-6 priority-4 priority-default closed" href="/issues/10703">Bug #10703</a>: Invalid Dates Bug Patch</i> added</li></ul> Ruby master - Bug #10588: Invalid Dateshttps://redmine.ruby-lang.org/issues/10588?journal_id=508342015-01-07T16:29:20ZNorthernLights (Imran "")
<ul><li><strong>File</strong> <a href="/attachments/4972">SmartTime.rb</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4972/SmartTime.rb">SmartTime.rb</a> added</li></ul><p>Patch to the above bug :</p>
<pre><code>class SmartTime < Time
def self.mktime year, month, day
case month
when 4, 6, 9, 11
if day == 31
raise ArgumentError, 'argument out of range _ APR, JUNE, SEP, NOV', caller
else
super
end
when 2
case day
when 30, 31
raise ArgumentError, 'argument out of range _ FEB', caller
when 29
if year%100 == 0
if year%400 == 0
super
else
raise ArgumentError, 'argument out of range _ FEB', caller
end
else
if year%4 == 0
super
else
raise ArgumentError, 'argument out of range _ FEB', caller
end
end
else
super
end
else
super
end
end
end
</code></pre> Ruby master - Bug #10588: Invalid Dateshttps://redmine.ruby-lang.org/issues/10588?journal_id=511672015-01-22T01:39:34Zakr (Akira Tanaka)akr@fsij.org
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-6 priority-4 priority-default closed" href="/issues/10767">Bug #10767</a>: Time.local doesn't raise an exception during the dead hour on DST</i> added</li></ul> Ruby master - Bug #10588: Invalid Dateshttps://redmine.ruby-lang.org/issues/10588?journal_id=511702015-01-22T02:38:04Zakr (Akira Tanaka)akr@fsij.org
<ul><li><strong>Assignee</strong> set to <i>akr (Akira Tanaka)</i></li></ul>