Open Ndrou opened 9 years ago
If someone else have the same problem, below a temporary fix :
If you need to get date, get the date as string :
SELECT birthDate.format("yyyy-MM-dd HH:mm:ss:SSS Z", "UTC") as birthDate FROM User
And in javascript, reconstruct the date field :
var resultDate = new Date(result[0].birthDate);
Created your test case in Java and passes.
The LONG value of 1200-11-11T00:00:00.000Z
in javascript is -24271660800000
.
When i select this field with orientjs, the raw result equals -24271056000000
-24271660800000 = Sat, 11 Nov 1200 00:00:00 GMT
-24271056000000 = Sat, 18 Nov 1200 00:00:00 GMT
You should test the LONG value returned to the binary protocol.
@Ndrou
the problem is
JavaScript
var expectedDate = new Date("1200-11-11T00:00:00.000Z");
console.log(expectedDate.getTime());
-24271660800000
Java
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date d = format.parse("1200-11-11 00:00:00.000");
System.out.println(d.getTime());
-24271059600000
In the meantime, we have fixed the problem by storing dates as LONG.
Hi,
I have a problem when inserting date before the start of the gregorian calendar (10-15-1582)
If i insert a date in OrientDb before 10-15-1582, the date returned on select does not match to the inserted.
If i insert a date in OrientDb after 10-15-1582, the date returned on select match to the inserted.
I have created a unit test if you want to see :