View Full Version : Ext.form.DateField should not misinterpret '0000-00-00' value
willydee
19 Oct 2007, 5:15 PM
I noticed a change in date handling between 1.0.1 and 1.1/2.0 which I consider being erroneous. In Ext 1.0.x, Ext.form.DateField interpreted a '0000-00-00' value as it's supposed to be
mystix
19 Oct 2007, 9:29 PM
this is not a bug. the Date.parseDate() method was fixed in 1.1.x to behave in the same way as PHP's date() method. (as stated in the docs, "The date parsing and format syntax is a subset of PHP's date() function, and the formats that are supported will provide results equivalent to their PHP versions.")
<?php
echo date("Y-m-d", "0000-00-00"); // returns the string 1970-01-01
?>
<script type="text/javascript">
Date.parseDate('0000-00-00', 'Y-m-d'); // returns the Date object for Jan 01 1970 00:00:00
</script>
if you need to have a "date not set" value, you should use javascript's null value.
[edit]
found this link which talks about dates in the years 0000 (i.e. 0 AD) to 0099 (i.e. 99 AD):
http://www.merlyn.demon.co.uk/js-datex.htm#SMD
p.s. the Date.parseDate() method will handle all year strings on or between 100 AD to 1969 AD correctly.
try this
Date.parseDate("0100", "Y"); // returns the correct date for the year 100AD
Date.parseDate("1969", "Y"); // returns the correct date for the year 1969AD
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.