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

Reply via email to