You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by co...@cristallium.com on 2022/05/18 21:12:40 UTC

compiler issue or not ?

Hi All,

I notice something strange  (using sdk 0.9.9), take this code :

var d1:Date = new Date();
d1.hours = d1.minutes = d1.milliseconds = 0;
trace ("d1->" + d1.getTime());

var d2:Date = new Date();
d2.hours = 0;
d2.minutes = 0;
d2.milliseconds = 0;
trace ("d2->" + d2.getTime());

It will show this result :

d1->NaN
d2->1652824822000

Do I need to report this as an issue ? or X = Y = Z = 0 is a bad 
practice in as3 (or I'm wrong using Date ?) ?

Regards
Fred



Re: compiler issue or not ?

Posted by co...@cristallium.com.
Done :

https://github.com/apache/royale-compiler/issues/212

Le 2022-05-18 23:26, Greg Dove a écrit :

> Please report that as an issue. For the first one, I assume it is
> generating something like 
> d1.setHours(d1.setMinutes(d1.setMillseconds(0)))
> ? That is going to cause problems, because each of those methods 
> returns
> the 'getTime()' value, and not the value that was set.
> 
> On Thu, May 19, 2022 at 9:12 AM <co...@cristallium.com> wrote:
> 
>> Hi All,
>> 
>> I notice something strange  (using sdk 0.9.9), take this code :
>> 
>> var d1:Date = new Date();
>> d1.hours = d1.minutes = d1.milliseconds = 0;
>> trace ("d1->" + d1.getTime());
>> 
>> var d2:Date = new Date();
>> d2.hours = 0;
>> d2.minutes = 0;
>> d2.milliseconds = 0;
>> trace ("d2->" + d2.getTime());
>> 
>> It will show this result :
>> 
>> d1->NaN
>> d2->1652824822000
>> 
>> Do I need to report this as an issue ? or X = Y = Z = 0 is a bad
>> practice in as3 (or I'm wrong using Date ?) ?
>> 
>> Regards
>> Fred

-- 
Frédéric Gilli

mob.0668542622

http://www.cristallium.com

  [1]



Links:
------
[1] http://www.cristallium.com

Re: compiler issue or not ?

Posted by co...@cristallium.com.
You are totally right :

var /** @type {Date} */ d1 = new Date();
d1.setHours(d1.setMinutes(d1.setMilliseconds(0)));
org.apache.royale.utils.Language.trace("d1->" + d1.getTime());

Le 2022-05-18 23:26, Greg Dove a écrit :

> Please report that as an issue. For the first one, I assume it is
> generating something like 
> d1.setHours(d1.setMinutes(d1.setMillseconds(0)))
> ? That is going to cause problems, because each of those methods 
> returns
> the 'getTime()' value, and not the value that was set.
> 
> On Thu, May 19, 2022 at 9:12 AM <co...@cristallium.com> wrote:
> 
>> Hi All,
>> 
>> I notice something strange  (using sdk 0.9.9), take this code :
>> 
>> var d1:Date = new Date();
>> d1.hours = d1.minutes = d1.milliseconds = 0;
>> trace ("d1->" + d1.getTime());
>> 
>> var d2:Date = new Date();
>> d2.hours = 0;
>> d2.minutes = 0;
>> d2.milliseconds = 0;
>> trace ("d2->" + d2.getTime());
>> 
>> It will show this result :
>> 
>> d1->NaN
>> d2->1652824822000
>> 
>> Do I need to report this as an issue ? or X = Y = Z = 0 is a bad
>> practice in as3 (or I'm wrong using Date ?) ?
>> 
>> Regards
>> Fred

Re: compiler issue or not ?

Posted by Greg Dove <gr...@gmail.com>.
Please report that as an issue. For the first one, I assume it is
generating something like d1.setHours(d1.setMinutes(d1.setMillseconds(0)))
? That is going to cause problems, because each of those methods returns
the 'getTime()' value, and not the value that was set.



On Thu, May 19, 2022 at 9:12 AM <co...@cristallium.com> wrote:

> Hi All,
>
> I notice something strange  (using sdk 0.9.9), take this code :
>
> var d1:Date = new Date();
> d1.hours = d1.minutes = d1.milliseconds = 0;
> trace ("d1->" + d1.getTime());
>
> var d2:Date = new Date();
> d2.hours = 0;
> d2.minutes = 0;
> d2.milliseconds = 0;
> trace ("d2->" + d2.getTime());
>
> It will show this result :
>
> d1->NaN
> d2->1652824822000
>
> Do I need to report this as an issue ? or X = Y = Z = 0 is a bad
> practice in as3 (or I'm wrong using Date ?) ?
>
> Regards
> Fred
>
>
>