-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Fixed clock module sunrise/sunset timezone bug #3070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
## [2.22.0] - 2023-01-01 Thanks to: @angeldeejay, @buxxi, @dariom, @dWoolridge, @KristjanESPERANTO, @MagMar94, @naveensrinivasan, @retroflex, @SkySails and @tom. Special thanks to @khassel, @rejas and @sdetweil for taking over most (if not all) of the work on this release as project collaborators. This version would not be there without their effort. Thank you! ### Added - Added test for remoteFile option in compliments module - Added hourlyWeather functionality to Weather.gov weather provider - Removed weatherEndpoint definition from weathergov.js (not used) - Added css class names "today" and "tomorrow" for default calendar - Added Collaboration.md - Added new github action for dependency review (MagicMirrorOrg#2862) - Added a WeatherProvider for Open-Meteo - Added Yr as a weather provider - Added config options "ignoreXOriginHeader" and "ignoreContentSecurityPolicy" ### Removed - Removed usage of internal fetch function of node until it is more stable ### Updated - Cleaned up test directory (MagicMirrorOrg#2937) and jest config (MagicMirrorOrg#2959) - Wait for all modules to start before declaring the system ready (MagicMirrorOrg#2487) - Updated e2e tests (moved `done()` in helper functions) and use es6 syntax in all tests - Updated da translation - Rework weather module - Make sure smhi provider api only gets a maximum of 6 digits coordinates (MagicMirrorOrg#2955) - Use fetch instead of XMLHttpRequest in weatherprovider (MagicMirrorOrg#2935) - Reworked how weatherproviders handle units (MagicMirrorOrg#2849) - Use unix() method for parsing times, fix suntimes on the way (MagicMirrorOrg#2950) - Refactor conversion functions into utils class (MagicMirrorOrg#2958) - The `cors`-method in `server.js` now supports sending and recieving HTTP headers - Replace `…` by `…` - Cleanup compliments module - Updated dependencies including electron to v22 (MagicMirrorOrg#2903) ### Fixed - Correctly show apparent temperature in SMHI weather provider - Ensure updatenotification module isn't shown when local is _ahead_ of remote - Handle node_helper errors during startup (MagicMirrorOrg#2944) - Possibility to change FontAwesome class in calendar, so icons like `fab fa-facebook-square` works. - Fix cors problems with newsfeed articles (as far as possible), allow disabling cors per feed with option `useCorsProxy: false` (MagicMirrorOrg#2840) - Tests not waiting for the application to start and stop before starting the next test - Fix electron tests failing sometimes in github workflow - Fixed gap in clock module when displayed on the left side with displayType=digital - Fixed playwright issue by upgrading to v1.29.1 (MagicMirrorOrg#2969) Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com> Co-authored-by: Karsten Hassel <hassel@gmx.de> Co-authored-by: Malte Hallström <46646495+SkySails@users.noreply.github.com> Co-authored-by: Veeck <github@veeck.de> Co-authored-by: veeck <michael@veeck.de> Co-authored-by: dWoolridge <dwoolridge@charter.net> Co-authored-by: Johan <jojjepersson@yahoo.se> Co-authored-by: Dario Mratovich <dario_mratovich@hotmail.com> Co-authored-by: Dario Mratovich <dario.mratovich@outlook.com> Co-authored-by: Magnus <34011212+MagMar94@users.noreply.github.com> Co-authored-by: Naveen <172697+naveensrinivasan@users.noreply.github.com> Co-authored-by: buxxi <buxxi@omfilm.net> Co-authored-by: Thomas Hirschberger <47733292+Tom-Hirschberger@users.noreply.github.com> Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com> Co-authored-by: Andrés Vanegas Jiménez <142350+angeldeejay@users.noreply.github.com>
Create Thai Language file. Translation from English to Thai. Co-authored-by: veeck <michael@veeck.de>
Updated sunrise/sunset times to display user-requested timezone rather than system timezone
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## develop #3070 +/- ##
===========================================
+ Coverage 27.52% 27.95% +0.42%
===========================================
Files 52 52
Lines 11568 11574 +6
===========================================
+ Hits 3184 3235 +51
+ Misses 8384 8339 -45
... and 2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
rejas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small change necessary. but thanks for the PR, do you feel experienced enough for writing a test about this too?
modules/default/clock/clock.js
Outdated
|
|
||
| // Convert sunrise/sunset time to local representation of requested timezone | ||
| if (this.config.timezone) { | ||
| sunTimes.sunrise = sunTimes.sunrise.toLocaleString("en-us", { timeZone: this.config.timezone }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably needs to respect the "locale" config value instead of the hardcoded "en-us"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will update to respect "locale" and investigate writing an integ test
rejas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, any luck with a test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, tested it and doesnt work.
Locale has to be done somthign like
const locale = config.locale??'en-US';
but there seem to be other issues with toLocaleString:
Adding locale: "de-DE" to my config leads then to an "invalid date" on the ui...
|
I'll make that change to fall back to en-US but also start to troubleshoot other locales to figure out what's going on there. As for a test, is there an existing test module i should add to or is the intention for me to write a new test for the clock module? |
|
Confirming that locale The error is not necessarily within Will need to research better internationalization support for this function |
|
Found a fix for localization of time. Don't have time to implement it tonight but it is possible to call
|
Fixes MagicMirrorOrg#3056 One question here would be if the default for this new option should be true or false. True: keeps the current behaviour, nobody needs to change his config if they rely on this option False: keeps the clock notifications quiet, doesnt waste time/resources, keeps the noise low Maybe the original author @cybex-dev can weigh in on this, and why he added this notification. --------- Co-authored-by: veeck <michael@veeck.de>
Fixes MagicMirrorOrg#3056 One question here would be if the default for this new option should be true or false. True: keeps the current behaviour, nobody needs to change his config if they rely on this option False: keeps the clock notifications quiet, doesnt waste time/resources, keeps the noise low Maybe the original author @cybex-dev can weigh in on this, and why he added this notification. --------- Co-authored-by: veeck <michael@veeck.de>
Do we need the locale at all? For formatting the time we already have showPeriod / showPeriodUpper in the module, so what else would the locale help here in terms of foramtting time? Take alook at my PR here: #3073 Maybe you could just use that new util method for formatting the sunrise/sunset time (once it is merged of course)? |
|
Using locale was initially intended to be a lightweight fix just for converting timezones, but using moment.tz in the common util works just as well and introduces less disruption to the existing code base. If you're already refactoring formatTime then I like your solution for converting to timezone in that function. I'll update this PR considering that solution. Thanks! |
…3079) - current electron v22 has end of life 07 Jul 2023 so it has to be upgraded before next release - removed th.json from root dir (came back with latest release) - updated other dependencies
after the year in calendar repeatingCountTitle (MagicMirrorOrg#2896, second attempt ...)
node v14 will have reached end-of-life by the next release. From April 18th we can use node v20 instead of v19 for testing.
- add test for serveronly, fixes MagicMirrorOrg#3076 - use template literals in port_variable.js.template
While looking at MagicMirrorOrg#3070 I noticed that the weather and clock module do some formatTime stuff, so why not use a common function for that? --------- Co-authored-by: veeck <michael@veeck.de>
needed for new formatTime unit tests. Avoiding ugly TZ setting in github workflows, see MagicMirrorOrg#3073
|
Hi @JakeBinney with #3073 merged, can you check if the latest develop branch fixes your bug too? |
|
A bug is still present in latest develop branch. Sunrise/sunset times are now showing in local timezone but are only showing current time. E.g. current time = sunrise time = sunset time. Trying to figure out if I'm crazy... |
|
Updated utils.js. Was converting current time instead of converting time passed by SunCalc. Sunrise/Sunset times look good now! |
|
Good catch :-) Adjusted my faulty tests so that they would fail if your PR wasnt there. |
|
@rejas looking in the changed files of this PR is a mess, there are 18 files changed but in the resulting merge commit only 2 changed. So in the future I would appreciate to rebase (or merge latest |
|
I agree @khassel. Weird why github does this changed-files mess though... |
|
I was wondering about that yesterday. Was that something i did? I'm still trying to get better at git hygiene. |
not actively ... your PR was very old and I think you never get the changes from To avoid this you should rebase your branch on current My point was not to merge such a PR without rebase/merge to current This all has no impact to the new |
|
That all makes plenty of sense. I appreciate you taking the time to write all that out! |
Updated sunrise/sunset times to display user-requested timezone rather than system timezone.
Note: rebase of #3069 against develop rather than master
Hello and thank you for wanting to contribute to the MagicMirror² project
Please make sure that you have followed these 4 rules before submitting your Pull Request:
Note: Sometimes the development moves very fast. It is highly
recommended that you update your branch of
developbefore creating apull request to send us your changes. This makes everyone's lives
easier (including yours) and helps us out on the development team.
Thanks again and have a nice day!