(new Date()).getFullYear()
return 2007 witch look like correct, but
(new Date()).getYear()
return 107 if there is no graphical artifact on my side witch is
obviously incorrect.
Someone confirm or I'm too tired ?
Jean-Baptiste BRIAUD wrote:
I added more debug :
var date_birth = new Date('1/1/2006');
var thisYear = new Date().getYear();
var age = thisYear - date_birth.getYear();
pouette.setText(date_birth + " : " + thisYear + " : " + age);
The text show -> Invalid date : undefined : NaN
So, apparently, the probleme is on date_birth first,
note that does not mean there is no bug on getYear() (I'll try right
now).
P T Withington wrote:
Looks like a bug with the SWF compiler. Please file at
http://jira.openlaszlo.org.
As a work-around, try:
thisYear =(new Date).getFullYear()
which I just tested and appears to work correctly.
On 2007-07-23, at 14:31 EDT, Jean-Baptiste BRIAUD wrote:
Hi the list !
Any idea why that code produce NaN ?
I'm not sure about the OL version since I tried that snipset online
with
http://www.openlaszlo.org/lps/laszlo-explorer/index.jsp?navset=nav10.xml&bookmark=Introduction
When I try my full code with 4.0.2 I got this error :
WARNING: pet-create-1.lzx:329: reference to undefined property
'getFullYear'
ERROR: Compiler.substitute:-1: undefined object does not have a
property 'make'
Are there known issue with JavaScript Date Object ?
--------------------------------------
<canvas width="200" >
<simplelayout axis="y" spacing="5"/>
<text id="pouette"/>
<button text="OK">
<handler name="onclick">
var date_birth = new Date("1/1/2006");
var thisYear = new Date().getFullYear();
var age = thisYear - date_birth.getFullYear();
pouette.setText(age);
</handler>
</button>
</canvas>