Pass info needed by Js library from server side? So that both sides are in synchrony. On 5 Dec 2014 05:59, "Maxim Solodovnik" <[email protected]> wrote:
> The problem I see with any JS library is: timezones are changes, OS and > java knows the full history > Any JS library need to maintain the full TZ list and all changes. > > In my code I get TZ rules (the exact date-time of each DST shift in a year) > and pass these data to java, then using Java's timezone definitions (which > are up to date and maintained by Java vendor) I'm trying to guess the > current TZ. > > And it should work since we need to get TZ on Java side. > > > On Fri, Dec 5, 2014 at 10:44 AM, Ernesto Reinaldo Barreiro < > [email protected]> wrote: > > > For an old project I was using some JS library... I will try to dig the > > code and see what library it was: it seemed to work correctly at the > time. > > > > On Thu, Dec 4, 2014 at 10:10 PM, Maxim Solodovnik <[email protected]> > > wrote: > > > > > I would love to have library for such automatic detection > > > But the list of time zones is limited, and it currently determines my > > > current time zone wrong :( > > > I'll check it's code and will try to enhance mine, I'll try to enhance > my > > > code > > > > > > In case you prefer to use this library I would vote for that since > > current > > > wicket code is also not very good :( > > > I believe this library can be used and enhanced. > > > > > > On Sat, Nov 29, 2014 at 1:43 AM, Maxim Solodovnik < > [email protected]> > > > wrote: > > > > > > > Thanks will try to check :) > > > > > > > > On Sat, Nov 29, 2014 at 1:33 AM, Martin Grigorov < > [email protected] > > > > > > > wrote: > > > > > > > >> Hi Maxim, > > > >> > > > >> Check http://joshowens.me/dealing-with-timezones-in-javascript/. It > > may > > > >> be > > > >> in use for you. > > > >> > > > >> Martin Grigorov > > > >> Wicket Training and Consulting > > > >> https://twitter.com/mtgrigorov > > > >> > > > >> On Tue, Nov 11, 2014 at 9:39 AM, Maxim Solodovnik < > > [email protected] > > > > > > > >> wrote: > > > >> > > > >> > OK, will try to do it after ApacheConEU > > > >> > Thanks for the review! > > > >> > > > > >> > On 11 November 2014 14:33, Martin Grigorov <[email protected]> > > > >> wrote: > > > >> > > > > >> > > I find the knowledge of the client timezone generally useful! > > > >> > > If you improve the points in my last mail and integrate it > > > >> > > in wicket-browser-info.js then it has better chance of being > > merged > > > >> ;-) > > > >> > > > > > >> > > Martin Grigorov > > > >> > > Wicket Training and Consulting > > > >> > > https://twitter.com/mtgrigorov > > > >> > > > > > >> > > On Tue, Nov 11, 2014 at 10:28 AM, Maxim Solodovnik < > > > >> [email protected] > > > >> > > > > > >> > > wrote: > > > >> > > > > > >> > > > you are right :( > > > >> > > > I can improve it if it worth so > > > >> > > > > > > >> > > > The idea was to get client timezone rulez using JS: the exact > > DST > > > >> > switch > > > >> > > > start/end date/time > > > >> > > > send this data to the server and then find Java timezone with > > best > > > >> > match > > > >> > > > > > > >> > > > > > > >> > > > On 11 November 2014 14:24, Martin Grigorov < > > [email protected]> > > > >> > wrote: > > > >> > > > > > > >> > > > > Hi Maxim, > > > >> > > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > >> > > > > > > https://github.com/solomax/tzdetect/blob/master/src/main/webapp/tzdetect.js > > > >> > > > > is not very usable in its current state. > > > >> > > > > My issues with it: > > > >> > > > > - no documentation > > > >> > > > > - no tests > > > >> > > > > - uses short named variables and method names (thus hard to > > > >> follow) > > > >> > > > > - ... > > > >> > > > > > > > >> > > > > I have forked it so I can use it as inspiration if I need it > > > >> later. > > > >> > > > > Feel free to remove it. > > > >> > > > > > > > >> > > > > Thanks! > > > >> > > > > > > > >> > > > > Martin Grigorov > > > >> > > > > Wicket Training and Consulting > > > >> > > > > https://twitter.com/mtgrigorov > > > >> > > > > > > > >> > > > > On Mon, Nov 10, 2014 at 6:02 PM, Maxim Solodovnik < > > > >> > > [email protected]> > > > >> > > > > wrote: > > > >> > > > > > > > >> > > > > > @Martin > > > >> > > > > > > > > >> > > > > > were you able to take a look at this code? > > > >> > > > > > Is it look useful? Or I can remove it? > > > >> > > > > > > > > >> > > > > > On 23 September 2014 00:54, Maxim Solodovnik < > > > >> [email protected] > > > >> > > > > > >> > > > > wrote: > > > >> > > > > > > > > >> > > > > > > Finally was able to create prototype: > > > >> > > > > > https://github.com/solomax/tzdetect > > > >> > > > > > > Maybe you can find it (or parts of it) usable > > > >> > > > > > > > > > >> > > > > > > On 3 September 2014 12:25, Maxim Solodovnik < > > > >> > [email protected]> > > > >> > > > > > wrote: > > > >> > > > > > > > > > >> > > > > > >> I believe if TZ rulez will be detected on client side, > > and > > > TZ > > > >> > > itself > > > >> > > > > on > > > >> > > > > > >> server side it might find user TZ good enough. (due to > TZ > > > >> list > > > >> > > with > > > >> > > > > > rulez > > > >> > > > > > >> will be maintained by java vendor, not JS library > itself) > > > >> > > > > > >> will try to modify the code and provide quickstart > > > >> > > > > > >> > > > >> > > > > > >> > > > >> > > > > > >> On 3 September 2014 18:18, Martin Grigorov < > > > >> > [email protected]> > > > >> > > > > > wrote: > > > >> > > > > > >> > > > >> > > > > > >>> see > https://github.com/moment/moment-timezone/issues/55 > > > >> > > > > > >>> if Moment.js cannot do it then I don't think we will > do > > it > > > >> > > > > > >>> > > > >> > > > > > >>> Martin Grigorov > > > >> > > > > > >>> Wicket Training and Consulting > > > >> > > > > > >>> https://twitter.com/mtgrigorov > > > >> > > > > > >>> > > > >> > > > > > >>> > > > >> > > > > > >>> On Wed, Sep 3, 2014 at 12:13 PM, Maxim Solodovnik < > > > >> > > > > > [email protected]> > > > >> > > > > > >>> wrote: > > > >> > > > > > >>> > > > >> > > > > > >>> > there seems to be timezones with more than 1 dst > start > > > per > > > >> > year > > > >> > > > :( > > > >> > > > > > >>> > code should be updated to reflect this :( > > > >> > > > > > >>> > > > > >> > > > > > >>> > > > > >> > > > > > >>> > On 3 September 2014 16:11, Maxim Solodovnik < > > > >> > > > [email protected]> > > > >> > > > > > >>> wrote: > > > >> > > > > > >>> > > > > >> > > > > > >>> > > was tested against multiple Time zones listed > here: > > > >> > > > > > >>> > > http://www.worldtimezone.com/daylight.html and > own > > TZ > > > >> > > > > > >>> (Asia/Novosibirsk) > > > >> > > > > > >>> > > > > > >> > > > > > >>> > > > > > >> > > > > > >>> > > On 3 September 2014 16:09, Maxim Solodovnik < > > > >> > > > > [email protected]> > > > >> > > > > > >>> > wrote: > > > >> > > > > > >>> > > > > > >> > > > > > >>> > >> here is the JS code > > > >> > > > > > >>> > > https://gist.github.com/solomax/e86cc77694d67120b8f5 > > > >> > > > > > >>> > >> to get DST start date/time (if any) > > > >> > > > > > >>> > >> only minute offset was not tested due to > > impossibili > > > to > > > >> > set > > > >> > > TZ > > > >> > > > > > >>> "Chatham > > > >> > > > > > >>> > >> Island" on my Ubuntu) > > > >> > > > > > >>> > >> > > > >> > > > > > >>> > >> similar code can be added to get DST end > date/time > > > >> > > > > > >>> > >> > > > >> > > > > > >>> > >> the code also might need to be "polished" a > little > > > >> > > > > > >>> > >> > > > >> > > > > > >>> > >> > > > >> > > > > > >>> > >> On 3 September 2014 19:59, Martin Grigorov < > > > >> > > > > [email protected]> > > > >> > > > > > >>> > wrote: > > > >> > > > > > >>> > >> > > > >> > > > > > >>> > >>> On Sep 3, 2014 10:39 AM, "Maxim Solodovnik" < > > > >> > > > > > [email protected]> > > > >> > > > > > >>> > >>> wrote: > > > >> > > > > > >>> > >>> > > > > >> > > > > > >>> > >>> > Actually my code can be extended to get > > > >> > > > > > >>> > >>> > 1) if TZ has DST or not > > > >> > > > > > >>> > >>> > 2) what month DST happening > > > >> > > > > > >>> > >>> > 3) the day of month DST happening > > > >> > > > > > >>> > >>> > 4) hour of day DST happening > > > >> > > > > > >>> > >>> > > > > >> > > > > > >>> > >>> > I believe after all this info is available the > > > list > > > >> of > > > >> > > time > > > >> > > > > > zones > > > >> > > > > > >>> > with > > > >> > > > > > >>> > >>> > certain offset can be reduced to better match > > > >> current > > > >> > > user > > > >> > > > > TZ. > > > >> > > > > > >>> > >>> > I can provide sample JS code for 1-4 above > > > >> > > > > > >>> > >>> > > > >> > > > > > >>> > >>> This will increase the chance to include it ! > ;-) > > > >> > > > > > >>> > >>> > > > >> > > > > > >>> > >>> > > > > >> > > > > > >>> > >>> > > > > >> > > > > > >>> > >>> > On 3 September 2014 14:22, Martin Grigorov < > > > >> > > > > > [email protected] > > > >> > > > > > >>> > > > > >> > > > > > >>> > >>> wrote: > > > >> > > > > > >>> > >>> > > > > >> > > > > > >>> > >>> > > Hi Maxim, > > > >> > > > > > >>> > >>> > > > > > >> > > > > > >>> > >>> > > Can you please provide more information how > > your > > > >> code > > > >> > > > > solves > > > >> > > > > > >>> the > > > >> > > > > > >>> > >>> problem ? > > > >> > > > > > >>> > >>> > > AFAIU Robert explains that Wicket's code > > > properly > > > >> > > detects > > > >> > > > > the > > > >> > > > > > >>> > >>> timezone > > > >> > > > > > >>> > >>> > > offset, but since there are many timezone > ids > > > for > > > >> a > > > >> > > given > > > >> > > > > > >>> offset it > > > >> > > > > > >>> > >>> is > > > >> > > > > > >>> > >>> not > > > >> > > > > > >>> > >>> > > easy to detect the correct DST from the > > offset. > > > >> > > > > > >>> > >>> > > In your code I don't see anything that > should > > > >> provide > > > >> > > the > > > >> > > > > > >>> missing > > > >> > > > > > >>> > >>> timezone > > > >> > > > > > >>> > >>> > > id. > > > >> > > > > > >>> > >>> > > Or I am missing something ? > > > >> > > > > > >>> > >>> > > > > > >> > > > > > >>> > >>> > > Martin Grigorov > > > >> > > > > > >>> > >>> > > Wicket Training and Consulting > > > >> > > > > > >>> > >>> > > https://twitter.com/mtgrigorov > > > >> > > > > > >>> > >>> > > > > > >> > > > > > >>> > >>> > > > > > >> > > > > > >>> > >>> > > On Wed, Sep 3, 2014 at 9:44 AM, Maxim > > > Solodovnik < > > > >> > > > > > >>> > >>> [email protected]> > > > >> > > > > > >>> > >>> > > wrote: > > > >> > > > > > >>> > >>> > > > > > >> > > > > > >>> > >>> > > > Hello All, > > > >> > > > > > >>> > >>> > > > > > > >> > > > > > >>> > >>> > > > Some time ago we had user query [1] > claiming > > > >> wicket > > > >> > > > based > > > >> > > > > > TZ > > > >> > > > > > >>> > >>> detection is > > > >> > > > > > >>> > >>> > > > not accurate. > > > >> > > > > > >>> > >>> > > > I believe the detection can be enhanced: > DST > > > >> rules > > > >> > > can > > > >> > > > be > > > >> > > > > > >>> > detected > > > >> > > > > > >>> > >>> using > > > >> > > > > > >>> > >>> > > JS > > > >> > > > > > >>> > >>> > > > code and taken into account while TZ > > guessing > > > >> > > > > > >>> > >>> > > > > > > >> > > > > > >>> > >>> > > > here is the example of JS code determining > > > >> month TZ > > > >> > > > > switch > > > >> > > > > > is > > > >> > > > > > >>> > >>> happening: > > > >> > > > > > >>> > >>> > > > [2] line 50 > > > >> > > > > > >>> > >>> > > > > > > >> > > > > > >>> > >>> > > > Maybe it worth to implement something like > > > this > > > >> in > > > >> > > > > Wicket? > > > >> > > > > > >>> > >>> > > > > > > >> > > > > > >>> > >>> > > > [1] > > > >> http://markmail.org/message/v7vmfburg4zrtizk > > > >> > > > > > >>> > >>> > > > [2] > > > >> > > > > > >>> > >>> > > > > > > >> > > > > > >>> > >>> > > > > > > >> > > > > > >>> > >>> > > > > > >> > > > > > >>> > >>> > > > >> > > > > > >>> > >>> > > > >> > > > > > >>> > > > > >> > > > > > >>> > > > >> > > > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > >> > > > > > > https://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/main/webapp/js/openmeetings_functions.js?revision=1562780&view=markup > > > >> > > > > > >>> > >>> > > > > > > >> > > > > > >>> > >>> > > > -- > > > >> > > > > > >>> > >>> > > > WBR > > > >> > > > > > >>> > >>> > > > Maxim aka solomax > > > >> > > > > > >>> > >>> > > > > > > >> > > > > > >>> > >>> > > > > > >> > > > > > >>> > >>> > > > > >> > > > > > >>> > >>> > > > > >> > > > > > >>> > >>> > > > > >> > > > > > >>> > >>> > -- > > > >> > > > > > >>> > >>> > WBR > > > >> > > > > > >>> > >>> > Maxim aka solomax > > > >> > > > > > >>> > >>> > > > >> > > > > > >>> > >> > > > >> > > > > > >>> > >> > > > >> > > > > > >>> > >> > > > >> > > > > > >>> > >> -- > > > >> > > > > > >>> > >> WBR > > > >> > > > > > >>> > >> Maxim aka solomax > > > >> > > > > > >>> > >> > > > >> > > > > > >>> > > > > > >> > > > > > >>> > > > > > >> > > > > > >>> > > > > > >> > > > > > >>> > > -- > > > >> > > > > > >>> > > WBR > > > >> > > > > > >>> > > Maxim aka solomax > > > >> > > > > > >>> > > > > > >> > > > > > >>> > > > > >> > > > > > >>> > > > > >> > > > > > >>> > > > > >> > > > > > >>> > -- > > > >> > > > > > >>> > WBR > > > >> > > > > > >>> > Maxim aka solomax > > > >> > > > > > >>> > > > > >> > > > > > >>> > > > >> > > > > > >> > > > >> > > > > > >> > > > >> > > > > > >> > > > >> > > > > > >> -- > > > >> > > > > > >> WBR > > > >> > > > > > >> Maxim aka solomax > > > >> > > > > > >> > > > >> > > > > > > > > > >> > > > > > > > > > >> > > > > > > > > > >> > > > > > > -- > > > >> > > > > > > WBR > > > >> > > > > > > Maxim aka solomax > > > >> > > > > > > > > > >> > > > > > > > > >> > > > > > > > > >> > > > > > > > > >> > > > > > -- > > > >> > > > > > WBR > > > >> > > > > > Maxim aka solomax > > > >> > > > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > -- > > > >> > > > WBR > > > >> > > > Maxim aka solomax > > > >> > > > > > > >> > > > > > >> > > > > >> > > > > >> > > > > >> > -- > > > >> > WBR > > > >> > Maxim aka solomax > > > >> > > > > >> > > > > > > > > > > > > > > > > -- > > > > WBR > > > > Maxim aka solomax > > > > > > > > > > > > > > > > -- > > > WBR > > > Maxim aka solomax > > > > > > > > > > > -- > > Regards - Ernesto Reinaldo Barreiro > > > > > > -- > WBR > Maxim aka solomax >
