var date1= new Date(2021,7,1,0,0,0) //[same as haxe target to js](https://try.haxe.org/#46a55899)
console.log(date1.getTime()) //1627747200-000
const date2 = new Date('2021-07-01T00:00:00');
console.log(date2.getTime())//1625068800-000
There is Date.fromString but the formats it can take are different than js, so you’d have to do something like:
using StringTools;
class Test {
static function main() {
final date2 = Date.fromString("2021-07-01T00:00:00".replace("T", " "));
trace(date2.getTime());
}
}