I guess it's assuming all years are 4 digit and not 2 digit.  The date [1970 
Jan 1] is the date I believe is a lot of date/time numbers are based on for the 
start.  So it maybe this is ultimately saying if it's a two digit year and it's 
before January 1st 1970 they must mean the year 2000?


-Mark


-----Original Message-----
From: Justin Mclean [mailto:jus...@classsoftware.com] 
Sent: Thursday, April 18, 2013 12:29 AM
To: dev@flex.apache.org
Subject: Interesting code in DateField

Hi,

Funny little assumption in DateField's stringToDate function:

        if (yearString.length == 2 && yearNum < 70)
            yearNum+=2000;

So if you enter a two digit year 70 or above it thinks it's 1st century AD (?) 
and below 70 and it's the 21st century! Just what you need for date of birth 
fields :-)

I think more reasonable way of doing this is have a defaultCentury and set that 
to 1900 or 2000? Any other ideas?

Thanks,
Justin

Reply via email to