Community
Participate
Working Groups
Build Identifier: 20100617-1415 There is no method providing access to the client time zone. RWT provides access only to client locale via RWT.getLocale(). Thus, in some cases, internationalization is not easily realizable for dates. Reproducible: Always Steps to Reproduce: 1. Have client and web server in different time zones 2. Let user input date 3. Accept wrong date on server side
The following scenario: * UTC timezone on the server, i.e. ( Calendar and DateFormat UTC, obviously Date is always UTC ) * Client enters the date in his local time DateTime widget delivers time entered by the user in user's local time zone. I need to know the user time zone to make the conversion to UTC. I got the following solution for now: * Two phase listeners * One phase listener to upload the following code: var rightNow = new Date(); var jan = new Date( rightNow.getFullYear(), 0, 1, 2, 0, 0 ); var jul = new Date( rightNow.getFullYear(), 6, 1, 2, 0, 0); var ofs = Math.max( jan.getTimezoneOffset(), jul.getTimezoneOffset() ) * 60000 * (-1); var req = org.eclipse.swt.Request.getInstance(); req.addParameter( someConstant, ofs ); req.send(); * Another phase listener waits for the result & converts it to java.uti.TimeZone - guessing the timezone from TimeZone.getAvailableIDs( rawOffset ) * Both remove themselves once they are run.
Having this method will be beneficial to our project as well. Casted one vote on this enhancement! :)
With commit 56a51f58c74054f11ad39bef88296b22602f31f7 the timezone offset as returned by JavaScript can now be obtained via: RWT.getClient().getService( ClientInfo.class ).getTimezoneOffset()