75 Commits

Author SHA1 Message Date
Ben Nitkin
55cd03576f
Show moon phase in clock module (#3284)
This change replaces the font-awesome moon icon and percent-lit with an
icon showing the current lunar phase.

It uses emoji, which may not be installed on all machines. The fallback
text version is backwards (the dark part of the moon is text-color,
which is normally black but white in MagicMirror).

---------

Co-authored-by: veeck <michael.veeck@nebenan.de>
2023-12-13 09:43:07 +01:00
Bugsounet - Cédric
af0fe37f70
Fix: Uncaught SyntaxError: Identifier 'getCorsUrl' has already been declared (#3204)
Issue #3202 

move shared modules/default/utils.js file to index.html
2023-09-19 07:14:11 +02:00
Veeck
f802c85a38
Fix undefined error for showSunTime / showMoonTime in clock module (#3146)
Fixes #3143 and adds tests for showSunTime / showMoonTime
2023-07-02 22:10:58 +02:00
Jørgen Veum-Wahlberg
babd22b04f
Bug fix: adding date to the analog clock if showDate is true (#3101)
Adding date to the clock module when displayType is "analog" and
"showDate" is true. The setting in analogShowDate is respected.

Fixes #3100

---------

Co-authored-by: Michael Teeuw <michael@xonaymedia.nl>
Co-authored-by: Veeck <github@veeck.de>
2023-05-19 14:52:59 +02:00
Veeck
32192d1698
Refactor formatTime into util class (#3073)
While looking at https://github.com/MichMich/MagicMirror/pull/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>
2023-04-07 23:11:54 +02:00
Veeck
b5a22bc09b
Add sendNotifications option to clock module (#3059)
Fixes #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>
2023-04-01 21:40:05 +02:00
Kristjan ESPERANTO
d276a7ddb9
Use template literals instead of string concatenation (#3066)
We have used it inconsistently till now. Template literals are more
modern and easier to maintain in my opinion.

Because that's a large amount of changes, here's a way to reproduce it:
I added the rule `"prefer-template": "error"` to the `.eslintrc.json`
and did an autofix. Since this caused a new problem in line 409 of
`newsfeed.js`, I reversed it in that line and also removed the rule from
the eslint config file.

The rule is described here:
https://eslint.org/docs/latest/rules/prefer-template

Note: I've played around with some other linter rules as well, and some
seem to point to some specific, non-cosmetic, issues. But before I dive
even deeper and then introduce even bigger and hardly understandable
changes at once, I thought I'd start with this simple cosmetic rule.
2023-03-19 14:32:23 +01:00
Kristjan ESPERANTO
b08a4737af
Update stylelint (#3042)
1. Update `stylelint` dependencies
- As of stylelint v15, we do not need `stylelint-config-prettier`
anymore:
https://github.com/prettier/stylelint-config-prettier/releases/tag/v9.0.5
2. Switch to `stylelint-config-standard`:
`stylelint-prettier/recommended` has not been updated for a long time
and still needs the old `stylelint-config-prettier`
3. Handle new `stylelint` issues
2023-02-19 21:36:50 +01:00
Veeck
eee289aee8
Only add clock type wrappers to DOM when they are used (#2971)
Fixes a layout gap when digital clock is displayd on the left

Reported via discord:
https://discord.com/channels/545884423703494657/545884914982322177/1044376412997562418

Co-authored-by: veeck <michael@veeck.de>
2022-12-10 21:17:29 +01:00
Kristjan SCHMIDT
a5668b1b99 Magic Mirror -> MagicMirror²
Consistent spelling
2022-01-26 23:09:26 +01:00
Christopher Fenner
1619dd29e9
Apply suggestions from code review 2022-01-06 21:28:25 +01:00
Christopher Fenner
990d1adfb2
use solid type for font awesome icons 2022-01-05 13:26:50 +01:00
rejas
6225abb010 Fix showTime parameter 2021-08-29 20:00:55 +02:00
rejas
f9639d9705 Refactor clock to allow finer placement of analog clock 2021-08-07 13:30:55 +02:00
rejas
ef2ff50089 Use es6 notation in clock module 2021-04-17 16:29:38 +02:00
Szymon Bluma
5781c258e0
A space after icon of sunrise and sunset 2020-10-16 13:10:02 +02:00
rejas
90cca28e01 Cleanup clock jsdoc 2020-07-30 09:36:01 +02:00
rejas
43bcf4ab98 Run eslint over files, see what gets fixed automatically and clean up 2020-07-27 14:25:43 +02:00
Michael Teeuw
22fcee2a16 Merge branch 'develop' into pr/ZoneMR/2061 2020-07-01 19:29:41 +02:00
ZoneMR
ea31d34649
Fix #2030 - Clock can be off by a minute
Set minute/second in our model based on the actual time from moment() rather than our own attempt to track the time - which can drift or fail to respond to time changes.

Also, schedule time refreshes to happen 50ms after the minute/second is expected to change - preventing premature fires and rapid re-firings of notifications due to accuracy limits in setTimeout
2020-06-30 19:51:25 +01:00
Veeck
abb5dc5739 Run prettier over ALL files once
No other changes done in this commit
2020-05-11 22:22:32 +02:00
Veeck
7fc7d626bc Add Module to globals, cleanup comments 2020-05-05 14:55:15 +02:00
rejas
b9d19cfcb4 First round of undef fixes 2020-05-03 12:40:48 +02:00
rejas
d8f093b226 Cleanup some globals 2020-05-02 10:33:24 +02:00
rejas
e7fc4ef1e7 Replace unsecure links with https ones 2020-04-28 23:05:28 +02:00
Veeck
ec187fe109 Update changelog and commen tags 2020-04-21 12:23:50 +02:00
rejas
d08bd4e866 Fix lots of warnings 2020-04-21 12:23:50 +02:00
rejas
941d5d7cd9 Fix mixed tabs and whitespace errors 2020-04-21 12:23:50 +02:00
rejas
6c926b8876 Add husky for pre-commit hook 2020-03-08 16:25:26 +01:00
rejas
5517a913d4 Run linter manually 2020-03-08 16:20:54 +01:00
Denis Treskunov
3f78c664eb fix floating point bug in moon illumination calc 2020-02-19 09:31:02 -08:00
Denis Treskunov
f4c3e412a2 fix bugs in showMoonTimes in clock module
1. as reported on https://github.com/MichMich/MagicMirror/pull/1885,
toLocaleString is not supported on old iPad Safari

2. SunCalc.getMoonTimes returns moonRise/moonSet times for the given date,
so moonRise can be after moonSet. We want to display the most relevant
times, which are today's moonRise and the next moonSet.
2020-02-09 22:03:35 -08:00
Denis Treskunov
9cffa3dd67 fix calculation of duration until next sunrise 2020-01-18 17:02:40 -08:00
Denis Treskunov
36762a6e46 add duration until next sunset/sunrise 2020-01-18 09:50:43 -08:00
Denis Treskunov
85a52523cf show sun/moon as bright rather than bold if obj is visible 2020-01-18 08:43:33 -08:00
Denis Treskunov
08b9e7b5b5 add sun/moon rise/set times
Icons become bold when the object is above the horizon. Also shows
percent of moon illumination.
2020-01-17 22:28:24 -08:00
buxxi
d208437c05 Changes to the clock module regarding the notifications sent. Disable sending of CLOCK_SECOND when displaySeconds not set. Avoid drifting by calculating the interval each time and use setTimeout instead of setInterval. Make sure the values sent with CLOCK_SECOND and CLOCK_MINUTE has the correct values instead of starting at 00:00 on startup 2019-09-22 17:33:01 +02:00
Michael Teeuw
7a272ef0ab Merge conflict. 2019-06-14 13:19:29 +02:00
rejas
835668d96d Add eslint semi rule 2019-06-05 10:23:58 +02:00
rejas
5c08bde0fa More == -> === and != -> !== fixes 2019-06-05 09:32:10 +02:00
Charles Dyason
b2f59d6813 Added clock notifications for elapsed time.
Added notifications to default `clock` module to broadcast:
 - `CLOCK_SECOND` for a clock second, and 
 - `CLOCK_MINUTE` for a clock minute having elapsed.

Each notification is broadcasted with the corresponding value i.e. `CLOCK_SECOND` -> `30` and `CLOCK_MINUTE` -> `5` .
2019-06-03 14:01:27 +02:00
Jon Kolb
44eccf5ee4 Only call updateDom in clock.js when the content has changed 2019-05-18 20:02:22 -04:00
Michael Teeuw
e4891e699f
Revert "Added autoLocation and autoTimezone option for weather modules and clock respectively." 2019-02-27 13:33:14 +01:00
Jacob Ebey
c608636b7a - Added autoTimezone property to the clock 2019-02-09 13:41:42 -08:00
andogit7
1bbf2d8ce6
Update clock.js 2019-01-05 17:04:33 +00:00
Wolf-Gideon Bleek
b4fd570269 moved weekNumber into field and adjusted language handling accordingly [issue #910] 2017-10-03 21:18:25 +02:00
Unknown
c15148fc07 Issue with date aligment in clock.js
In reference to issue #927. Made changes to clock.js and clock_styles.css to prevent aligment problem when displaying analog clock and large calendar entries
2017-06-26 20:19:13 +02:00
Veeck
20687d915a Remove unused vars and whitelines, cleanups 2017-06-02 19:35:10 +02:00
Johan Hammar
f4509e24c6 Added a week section to the clock module 2017-03-28 22:02:30 +02:00
Michael Teeuw
4aec39df7a Fix Merge Conflicts. 2017-03-17 14:32:01 +01:00