Thanks for looking at this, Doug. "Probably what should happen here is the script is fed the server time as a constant when the cheetah generator "creates" this script upon execution of StdReport. Then the code will evaluate that datevalue to determine if the theme should change." Until my Eastern time zone friend reported otherwise, I expected that this was the default behavior.
I suspect you are talking about this Github project page? https://github.com/poblabs/weewx-belchertown Eric On Sun, Mar 27, 2022 at 2:29 PM Doug Jenkins <[email protected]> wrote: > I looked at the code and yes, this is running on the client side. This > means the light/dark mode is determined y checking the person's web browser > and seeing if it is out of the range of sunrise hours. > > If it is, then the JavaScript changes the theme to dark, otherwise it > remains on light. > > So what this means if it is midnight where your weather station is on the > east coast of the US, a user in Tokyo (+13 hours) is going to see the light > theme of he goes to your weather website. > > Probably what should happen here is the script is fed the server time as a > constant when the cheetah generator "creates" this script upon execution of > StdReport. Then the code will evaluate that datevalue to determine if the > theme should change. > > If there is any interest on this item, I recommend putting in an issue on > the GitHub project and send it to me. I can do an update and submit a PR > with the correction. > > Doug Jenkins > > On Sun, Mar 27, 2022, 12:54 PM vince <[email protected]> wrote: > >> Easiest thing to do is figure it out experimentally. Connect into a >> Belchertown site on the other side of the ocean and see. >> >> On Sunday, March 27, 2022 at 9:33:58 AM UTC-7 Eric K wrote: >> >>> I gave a link to the file so you could look at it: >>> >>> https://github.com/poblabs/weewx-belchertown/blob/master/skins/Belchertown/js/belchertown.js.tmpl >>> >>> There is a definition of a "var d" at line 507. >>> var d = new Date(); >>> >>> I still can't tell where it's getting its time from. >>> >>> On Sat, Mar 26, 2022 at 6:37 PM Doug Jenkins <[email protected]> >>> wrote: >>> >>>> I think it is from the local client. The JavaScript is executed in the >>>> browser. >>>> >>>> We need to see where "D" is initialized to make sure it is not using a >>>> web api to obtain the time >>>> >>>> On Sat, Mar 26, 2022, 4:39 PM Eric K <[email protected]> wrote: >>>> >>>>> I have the Belchertown skin theme set to "auto" so it switches over to >>>>> the dark theme around sunset. >>>>> I have noted that the Belchertown skin switches over to the dark theme >>>>> at large fractions of an hour before sunset actually occurs. >>>>> Then, I got a report from a friend in the Eastern time zone, that the >>>>> webpage theme switched to dark around 6:00pm Eastern time - around 2 hours >>>>> early compared to the local sundown time (7:39pm Central) at my weewx >>>>> weather station. >>>>> He said he had not clicked the manual theme switch at the upper right >>>>> corner of the Belchertown page. >>>>> >>>>> So, I started looking through the code to see how the theme change >>>>> gets triggered. >>>>> >>>>> see: >>>>> https://github.com/poblabs/weewx-belchertown/blob/master/skins/Belchertown/js/belchertown.js.tmpl >>>>> >>>>> Around line 507 the current hour and minute get assigned to variables >>>>> with the expressions >>>>> var nowHour = d.getHours(); >>>>> var nowMinutes = d.getMinutes(); >>>>> Where is the time being read from? >>>>> 1. from the clock of the computer that weewx is running inside? >>>>> 2. from the clock of webpage visitor's computer? >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "weewx-user" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/weewx-user/7eb9e891-52a4-4e1f-9e04-e322bb2460bcn%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/weewx-user/7eb9e891-52a4-4e1f-9e04-e322bb2460bcn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- >>>> >>> You received this message because you are subscribed to a topic in the >>>> Google Groups "weewx-user" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/weewx-user/WfhDmYJZZZw/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/weewx-user/CACC0i0xDXGaD0%2BZZ0E-Cu3W6eo_QDOpbxoZ5m0tbe3OxKiCCAg%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/weewx-user/CACC0i0xDXGaD0%2BZZ0E-Cu3W6eo_QDOpbxoZ5m0tbe3OxKiCCAg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "weewx-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/weewx-user/d8f01090-8cc6-43c9-883c-8b797dcb1e85n%40googlegroups.com >> <https://groups.google.com/d/msgid/weewx-user/d8f01090-8cc6-43c9-883c-8b797dcb1e85n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "weewx-user" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/weewx-user/WfhDmYJZZZw/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/CACC0i0y-P1KaiLzcoUDaNnm-P8UhfsSf%3DJRGNgbRb_6SU18CUg%40mail.gmail.com > <https://groups.google.com/d/msgid/weewx-user/CACC0i0y-P1KaiLzcoUDaNnm-P8UhfsSf%3DJRGNgbRb_6SU18CUg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CADh_orh8kXUVF5rYESX3nv%3D%3DBXXeWmms3FYY8T%3DaOR9GxHjpTg%40mail.gmail.com.
