[Laszlo-user] Date issue (convertion from string)

P T Withington ptw at openlaszlo.org
Mon Jul 23 13:07:30 PDT 2007


The SWF runtime does not support parsing dates from strings.  It is a  
limitation imposed by Flash:

http://www.openlaszlo.org/lps/docs/guide/ecmascript-and- 
lzx.html#ftn.ecmascript.nodate

On 2007-07-23, at 15:10 EDT, 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>
>>>
>>
>>
>>
>



More information about the Laszlo-user mailing list