COMMUNITY

Date is whacky tobacky in hl and cpp targets in haxe 4

haxe-hl
haxe-cpp

(Thomas J Webb) #1

If anyone can point me to existing issues on this, that would be great. I found one that looked potentially related that was being ignored and commented on it.

But basically Date seems to be acting differently for me depending on the target. In the hl target, dates prior to the unix epoch are invalid:

var date = new Date(1905, 0, 12, 1, 4, 1);
trace(date.getFullYear()); // throws Uncaught exception: invalid date`

Dates prior to the unix epoch in the cpp target give me wrong values:

var date = new Date(1905, 0, 12, 1, 4, 1);
trace(date.getFullYear()); // prints 1900, wrong
trace(date.getMonth()); // prints 0, right
trace(date.getHours()); // prints 0, wrong

However, dates after work correctly (both cpp and hl):

var date = new Date(1975, 0, 12, 1, 4, 1);
trace(date.getFullYear()); // prints 1975, right
trace(date.getMonth()); // prints 0, right
trace(date.getHours()); // prints 1, right

In js everything works correctly. I’m having some technical issues getting haxe 3 working on the specific machine I’m on and am too lazy to switch OSes or machines right this second (every other machine I have has lix working smoothly where I can switch between haxe versions seamlessly). I also already am using some haxe 4-spefic features so if haxe 3 works fine here, that’s not of much help to me. But I am working off the assumption that this is a haxe 4 specific problem. Either that, or me doing something really wrong.

Is there already an open ticket on this if this is as I suspect, a bug?


(Simon Krajewski) #2

Please open an issue. This also causes errors on Eval, so at the very least I want to look into that.


(Thomas J Webb) #3

Okay I’m posting this as an issue