This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 251953 - Better handling of dates and timezones
Summary: Better handling of dates and timezones
Status: RESOLVED FIXED
Alias: None
Product: qa
Classification: Unclassified
Component: Dashboard (show other bugs)
Version: 8.1
Hardware: PC Linux
: P2 normal (vote)
Assignee: Vladimir Riha
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-20 15:35 UTC by Vladimir Riha
Modified: 2015-04-27 08:43 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2015-04-20 15:35:32 UTC
Problem is with following:

on server:

$db_when = '2015-04-16 20:17:28'
$timestamp = strtotime($db_when) * 1000;

in JS:

new Date(timestamp)


the issue is when timezone in server is not the same as in browser, as a result, there are wrong data

DB RECORD          |         $timestamp       |       new Date(timestamp)
==========================================================================
2015-04-16 20:17:28    1429229848000            Fri Apr 17 2015 02:17:28 GMT+0200 (CEST)


I'll probably leave server as it is and fix it on client side. Client will somehow know server's timezone (either from HTTP response or via new endpoint which will "translate" received time from client to server time) and convert all timestamps accordingly. 


I'll look at it at the end of the week
Comment 1 Vladimir Riha 2015-04-24 16:06:18 UTC
Profile page is now fixed.

I'm trying to find server's timezone and will set default timezone to UTC. The problem is that most of the data tables are rendered on server and server has no knowledge of client's timezone (sadly it is not standard of HTTP response and there is no guarantee of HTTP header). Right now it seems like server's timezone is -4, while UTC is -2 so more close and thus I'll will set default timezone to UTC
Comment 2 Vladimir Riha 2015-04-27 08:43:02 UTC
Server now uses UTC instead of America/NY timezone