Closed rjrudman closed 6 years ago
What is strange is that it's precisely my time zone (+2h), it usually would suggest that I'm doing something wrong. First debug step probably is to check exactly what arrives in json.
For complete information this is the code that I'm using
Instant detected = Instant.ofEpochSecond(System.currentTimeMillis()/1000);
rpr.setDetectedDate(OffsetDateTime.ofInstant(detected, ZoneId.systemDefault())); //systemDefault() --> +02:00
Instant cDate = Instant.ofEpochSecond(comment.getCreationDate()); //is the long returned from API that should be unixtimestamp in UTC
rpr.setContentCreationDate(OffsetDateTime.ofInstant(cDate, ZoneOffset.UTC));
Testing this code at 16:24:11 (my time) with comment.getCreationDate()=System.currentTimeMillis()/1000
in console will output.
detectedDate=2018-04-11T16:24:11+02:00 contentCreationDate=2018-04-11T14:24:11Z
Should be fixed now - we're now converting to UTC before saving to the database
For context: https://chat.stackoverflow.com/transcript/message/42058212
Looks like we're not properly handling timezones, likely on both the server and UI