Re: cvs: php4 /ext/standard datetime.c
| From: | Hartmut Holzgraefe | Date: | Wed, 14 Jun 2000 21:10:38 +0000 |
| Subject: | Re: cvs: php4 /ext/standard datetime.c | ||
| References: | 1 2 3 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-277@lists.php.net to get a copy of this message | ||
Hartmut Holzgraefe wrote:
> what about redefining the valid range of years as starting from year one
> instead of zero here? that shouldn't break to much and fix the problem
> for
> this case (anybody operating with dates before 1970 should be using the
> calendar extensions and julian days anyway, so loosing year 0 shouldn't
> harm)
>
> this ain't a general solution, but as a quick shot for checkdate() it
> should
> be ok ?!?
after looking at the code instead of the documentation i wonder what
checkdate() is supposed to do anyway, or how much sense the things it
does
make
if (y < 100)
y += 1900;
if (y < 0 || y > 32767) {
RETURN_FALSE;
}
...
RETURN_TRUE;
i see that the +1900 code is for leap year adaption of 'short' dates
but this a) not y2k ready, b) doesn't make sense in the effective
time range of year 100 to 32767 and c) will accept years from -100
to 32767 which itself doesn't make to much sense (julian/gregorian
calender shift and other reasons) ...
i'd suggest to reduce the valid range of years to something more
reasonable like Oct 15, 1582 to for example Dec 31 2399 with values
values from 0 to 99 shiftet up 2000 (2000 was a leap year, 1900 wasn't
all other years have same result for 20. and 21. century)