JS SDK e DA , datetime timezone problem

Hi,

RO SDK uses RemObjects.UTIL.ISO8601toDateTime (using strings) to convert date from the server, and it handling correctly timezones .

But using JS DA I’m having problems with date and timezone (here GMT-0300)…

I think this is the source of problem:

RemObjects.DataAbstract.Bin2DataStreamer.prototype.read

value = this.fParser.decodeFloat(this.fStream.substr(this.fStreamPos, 8), 52, 11);
this.fStreamPos += 8;
value = new Date(Math.round((value - 25569.0) * 86400000));

DA treats date as floating number. Object date is created using miliseconds (UTC based), but floating value from the server is passed GMT-0300, so my date is incorrect in client js side (3 hours back).

I am using Delphi/FPC+AnyDAC in server side…

any clue??

Thanks
Willian.

Thank you for such a detailed report. Yes, values are stored in the db in UTC and client side should convert them to/from local timezone.
Issue is logged as #54154, fix will be provided asap.

Hello, Willian!

I’ve investigated the subject a bit. DA doesn’t perform any timezone conversion, just stores values as is. So it’s javascript issue (or feature).

Please check if that’s the behaviour you need:

Bin2DataStreamer.read:

case “datDateTime”:
var utcValue = this.fParser.decodeFloat(this.fStream.substr(this.fStreamPos, 8), 52, 11);
utcValue = new Date(Math.round((utcValue - 25569.0) * 86400000));
value = new Date(utcValue.getUTCFullYear(), utcValue.getUTCMonth(), utcValue.getUTCDate(), utcValue.getUTCHours(), utcValue.getUTCMinutes(), utcValue.getUTCSeconds());
this.fStreamPos += 8;
break;

Bin2DataStreamer.write:

case “datDateTime”:
this.fStream += this.fParser.encodeFloat(aValue / 86400000 + 25569.0 - aValue.getTimezoneOffset() * 60000, 52, 11);
break;

Thanks Valeriy,

It worked!

This will be incorporated into the next beta?

Sure.