@Calin, you can use (new Date().getTimezoneOffset() / -60);
Then you can use code like this
http://examples8x.wicket.apache.org/ajaxhellobrowser/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage;jsessionid=01612235C0920A71B39B2D8CA0FA641A?0&SourcesPage_class=org.apache.wicket.examples.ajaxhellobrowser.AjaxHelloBrowser&source=AjaxHelloBrowser.java

to get this value on the server side

@Martin Actually the code works, BUT
1) for me it shows timezone as "GMT+07:00" instead of Asia/Novosibirsk
    And there are a lot of time zones with same offset ....
2) there are a lot of magic in the current code (for ex.
southern hemisphere time zone calculation
https://issues.apache.org/jira/browse/WICKET-6689)
3*) I guess this calculation can stop working in a year time zone rules are
changed

I believe this might be improvement to wicket code base to let browser do
the real time zone calculation :)

On Tue, 29 Oct 2019 at 00:21, Calin Pavel <calin.pa...@gmail.com> wrote:

> Current code is working ok. There is no problem with it.
> But it gives you the UtcOffset at 1.Jan.2019 and UtcDstOffset at
> 1.June.2019.
>
> But I do not know how to determine what is the CURRENT timezone offset
> (for Date.NOW)
>
> On 10/28/2019 6:24 PM, Martin Grigorov wrote:
> > Hi,
> >
> > I didn't get what is the problem with the current code.
> > For me http://examples8x.wicket.apache.org/ajaxhellobrowser/ shows
> > utcDSTOffset=3
> > utcOffset=2
> > which seems to be correct.
> >
> > On Mon, Oct 28, 2019 at 5:56 PM Maxim Solodovnik <solomax...@gmail.com>
> > wrote:
> >
> >> On the other hand: the old code can be used if TZ is not available
> >> I'll do some tests and will create PR
> >>
> >> On Mon, 28 Oct 2019 at 22:51, Maxim Solodovnik <solomax...@gmail.com>
> >> wrote:
> >>
> >>> @devs are we supporting IE11 for wicket9? if not we can add this call
> to
> >>> standard ClientProperties ...
> >>> WDYT?
> >>>
> >>> On Mon, 28 Oct 2019 at 22:48, Maxim Solodovnik <solomax...@gmail.com>
> >>> wrote:
> >>>
> >>>> Hello,
> >>>>
> >>>> according to stackoverflow [1]
> >>>> you can use Intl.DateTimeFormat().resolvedOptions().timeZone
> >>>> ClientProperties can be extended to get this info on server
> >>>>
> >>>> [1]
> >>>>
> >>
> https://stackoverflow.com/questions/6939685/get-client-time-zone-from-browser
> >>>> On Mon, 28 Oct 2019 at 22:26, Calin Pavel <calin.pa...@tvh.com>
> wrote:
> >>>>
> >>>>> I'm trying to detect what is the current timezone offset for a client
> >>>>> browser accessing my Wicket application.
> >>>>> I found out that BrowserInfoForm.ClientPropertiesBean contains
> details
> >>>>> about:
> >>>>> - utcOffset
> >>>>> - utcDstOffset
> >>>>> but these are calculated at 1.Jan and 1.June.
> >>>>>
> >>>>> Is there any way to determine on server side what is the CURRENT
> >> timezone
> >>>>> offset of the client?
> >>>>> I've tried to use ClientPropertiesBean.timeZone, but that is
> relative /
> >>>>> guest and not real client timezone.
> >>>>>
> >>>>>
> >>>>> --
> >>>>>
> >>>>> Kind Regards,
> >>>>>
> >>>>>
> >>>>> *CALIN PAVELSoftware Engineer - consultant*
> >>>>> calin.pa...@tvh.com
> >>>>>
> >>>>> *TVH PARTS HOLDING NV*
> >>>>> Vichtseweg 129 • BE-8790 WAREGEM
> >>>>> T +32 56 43 42 11 <+3256434211> • F +32 56 43 44 88 • www.tvh.com
> >>>>>
> >>>>> <https://www.tvh.com/>
> >>>>>
> >>>>> --
> >>>>>
> >>>>>
> >>>>> **** DISCLAIMER
> >>>>> <https://media.tvh.com/content/pdf/various/Email-disclaimer.pdf>
> ****
> >>>>>
> >>>>> This
> >>>>> message is delivered to all addressees subject to the conditions set
> >>>>> forth
> >>>>> in the attached disclaimer, which is an integral part of this
> message.
> >>>>>
> >>>>>
> >>>>> When you communicate with us via e-mail, telephone, fax or via our
> >>>>> website,
> >>>>> we process your personal data. For more information on how we process
> >>>>> your
> >>>>> personal data, please consult our Privacy Policy
> >>>>> <https://www.tvh.com/privacy-policy>. By communicating with us, you
> >>>>> unambiguously consent to our use of your personal data as explained
> in
> >>>>> the
> >>>>> Privacy Policy.
> >>>>>
> >>>>
> >>>> --
> >>>> WBR
> >>>> Maxim aka solomax
> >>>>
> >>>
> >>> --
> >>> WBR
> >>> Maxim aka solomax
> >>>
> >>
> >> --
> >> WBR
> >> Maxim aka solomax
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

-- 
WBR
Maxim aka solomax

Reply via email to