Project

General

Profile

Actions

Feature #1390

closed

Client side time

Added by Saif Rehman over 11 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
Start date:
08/08/2012
Due date:
% Done:

100%

Estimated time:

Description

Hello,

I've recently created a feature to get client side time in Wt. It is done by sending timezone offset and client local time from Boot.js

You can check it out at in the GitHub pull request at https://github.com/kdeforche/wt/pull/13

There are 2 methods. One is dependent on client's clock time and one is dependent of server's clock time. I added both because sometimes a client's time may be set incorrectly whereas their timezone is set correctly.

Actions #1

Updated by Saif Rehman over 11 years ago

I recommend that you at least take a look.

Actions #2

Updated by Koen Deforche over 11 years ago

  • Target version changed from 3.2.3 to 3.3.0
Actions #3

Updated by Koen Deforche about 11 years ago

  • Target version changed from 3.3.0 to 3.3.1
Actions #4

Updated by Koen Deforche over 10 years ago

  • Status changed from New to Resolved
  • Assignee set to Koen Deforche

So we've decided to implement the following:

  • WEnvironment::timeZoneOffset() returns the time zone offset of the client. This is simply made available but not used anywhere directly.
  • in WLocale, we've added setTimeZone() and timeZone() methods which are used to configure the (client local) timezone using POSIX time zone strings, e.g. "EST-5EDT,M4.1.0,M10.5.0" for NYC.
  • There is no direct way to derive the user's time zone from his current time zone offset. The best approach, it seems, is to ask the user and let him save this in his settings. There is however a public database that is distributed for example with the boost local_time library (date_time_zonespec.csv) which contains timezone information for many "region strings, e.g. "Europe/Brussels\", and moreover it should be possible to suggest a location to the user based on this database and the current timeZoneOffset using boost's tz_database. It seems definitely worth-while to implement such a widget either as an example or even in the library.
  • We've added a WLocalDateTime type which uses the time zone information from a WLocale to represent timestamps in the user's locale.
Actions #5

Updated by Saif Rehman over 10 years ago

I don't understand what's wrong with determining the user's timezone based on JavaScript's Date object?

Actions #6

Updated by Koen Deforche over 10 years ago

Hey Saif,

You can't? The Date object only gives the current timeZoneOffset. That doesn't tell you anything about how daylight saving's time is decided in the location of the user which may result in a different timeZoneOffset for other days of the year.

Regards,

koen

Actions #7

Updated by Koen Deforche over 10 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF