1

I'm seeing some confusing behavior:

I'm in the GMT time zone. I turn off my wifi, to make sure the internet isn't messing anything up.

I then load on this code to my application (cross browser, but running on Android):

var todayDate = new Date();
console.log(todayDate);

That gives me this: Thu Jun 22 2017 20:52:02 GMT-0500. I see this BOTH in the console.log and hovering over it in the Chrome debugger.

However, I now want to change my time zone. So I quit the application, and go to the system settings, and change it to New Zealand time (+12:00). I restart my application, but now I still see this: Thu Jun 22 2017 20:52:02 GMT-0500 (NZST). Notice, it picked up the NZST, but still says GMT-0500. This is a problem, because while the UTC time still works (naturally), the way the existing code is set up, the local time is already stored somewhere else.

I got around this by converting the local time to UTC and calculating the offset, but now when I changed the offset I'm not getting the right time zone (according to the tablet's time zone). Anyone have any ideas?

Kevin
  • 109
  • 12
  • what does your time (in windows) shows? and second you may want to check the bios time of your machine. – Edwin Jun 23 '17 at 12:38
  • That's the strange thing. On the tablet, I changed the time and the time zone (offset the time by about 15 minutes). When I try to display the date, it reflects the 15 minute offset, but not the time zone change (listed above) – Kevin Jun 23 '17 at 12:41
  • perhaps, https://stackoverflow.com/questions/16448754/how-to-use-a-custom-time-in-browser-to-test-for-client-vs-server-time-difference – gauravmuk Jun 23 '17 at 12:41
  • hmmm... gauravmuk, that's close. But that's a browser application, when I'm running mine on Android, and I completely uninstalled my application (so from the tablet's perspective, it only knows the custom time zone I set) – Kevin Jun 23 '17 at 12:44
  • 1
    The answer to the question in the title is "From the OS". However, you say "running on Android" - what sort of device is it? Something mainstream or custom? Is it possible your device does not have time zone support? It sounds more like an Android issue than a JavaScript issue. Also, I'm confused when you mix "hovering over it" and then say your on a tablet - are you on a tablet with a mouse attached? You also interchanged Chrome browser and "the application", so I'm not sure exactly what you're running... – Matt Johnson-Pint Jun 23 '17 at 17:52
  • I'm running on a Pixel C. I agree, I think the underlying issue probably is an Android issue. I'm running on the Pixel C, but am also viewing through the Chrome debugger on my computer... – Kevin Jun 23 '17 at 19:46

0 Answers0