Project

General

Profile

Actions

Bug #12297

closed

Ruby stdlib date can parse non-existent date with year 0

Added by globi (t b) over 6 years ago. Updated over 3 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:75007]

Description

Ruby date lib can parse date with year 0
$ pry [1] pry(main)> shitdate=Date.strptime('0000-01-07','%Y-%m-%d') => #<Date: 0000-01-07 ((1721064j,0s,0n),+0s,2299161j)> [2] pry(main)> shitdate.year => 0 [3] pry(main)>

There is no year 0 in gregorian and julian calendar between 1 BC and 1 AD
It should raise ArgumentError like it do when month/day number is 0.


Files

no_year_0.patch (1.62 KB) no_year_0.patch noahgibbs (Noah Gibbs), 06/03/2016 05:01 PM
Actions

Also available in: Atom PDF