32 Commits

Author SHA1 Message Date
kaennchenstruggle
2a6e2aacdc
Calendar translate (#3249)
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:**

> 1. Base your pull requests against the `develop` branch.

DONE ;D

> 2. Include these infos in the description:
> - Does the pull request solve a **related** issue?

NO
> - What does the pull request accomplish? Use a list if needed.

For calendar entries containing a year (e.g. DOB) in the title, the age
can be calculated.

Example before:

![grafik](https://github.com/MichMich/MagicMirror/assets/54073894/67ca65f4-24c3-46a8-bee8-0519e4bba3f5)
after:

![grafik](https://github.com/MichMich/MagicMirror/assets/54073894/0b4af07d-d3d9-4644-a4a6-e8c402598208)

Achieved by adding a new keyword `transform` to customEvents
```
customEvents: [
                        {keyword: 'Geburtstag', symbol: 'birthday-cake', color: 'Gold', transform: { search: '^([^\']*) \'(\\d{4})$' , replace: '$1 ($2.)', yearmatchgroup: 2}},
                        {keyword: 'in Hamburg', transform: { search: ' in Hamburg$' , replace: ''}} 
		],
```

and therewith obsoleting `titleReplace`; a backward compatibility part
is already included.

If `yearmatchgroup` is unset, behaviour is as in previous code (some
additions to which RegExes are accepted, though)

If `yearmatchgroup` is set, it is considered the RegEx match group id,
which will be used for calculating the age.



> - If it includes major visual changes please add screenshots.

NO

> 3. Please run `npm run lint:prettier` before submitting so that style
issues are fixed.

DONE

> 4. Don't forget to add an entry about your changes to the CHANGELOG.md
file.

DONE

> Thanks again and have a nice day!

You too and if any questions, feel free to let me know.

---------

Co-authored-by: veeck <michael.veeck@nebenan.de>
2023-11-01 00:07:56 +01:00
Karsten Hassel
a41aa48dd1
add .gitattributes and fix prettier/js warnings (#3094)
see title, as discussed in
https://github.com/MichMich/MagicMirror/pull/3093
2023-04-22 09:29:51 +02:00
Veeck
7e58b38ddf
Add no-param-reassign from eslint (#3089)
While waiting for the easterbunny I cleaned up some bad coding practice
:-)

Very open for comments especially regarding the places I commented
myself...

---------

Co-authored-by: veeck <michael@veeck.de>
2023-04-16 17:38:39 +02:00
Veeck
77f9c86774
Refactor calendar methods into util class (#3088)
Refactored some methods in calendar module:
- move methods into own file 
- dont call shorten method from titelTransform because why? just call
them after each other.
- added tests for util methods
- cleaned up other tests

---------

Co-authored-by: veeck <michael@veeck.de>
2023-04-09 12:49:50 +02:00
Kristjan ESPERANTO
5f38c53260
Revise require imports (#3071)
- order (external first)
- remove superfluous file extensions
- new line after imports
- deconstruct (only one time (in `check_config.js`))
- fix path (only one time (in `global-setup.js`))
2023-03-22 23:53:10 +01: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
Sam Detweiler
11d17dd2c0 fix typo, duplcate line 2022-09-06 13:29:08 -05:00
Sam Detweiler
174da38cc8 run prettier 2022-09-05 15:02:16 -05:00
Sam Detweiler
032f7ac299 fix events with rrule byweekday 2022-09-05 14:13:46 -05:00
buxxi
17c14e137e Make the calendar show the whole multi day event with how far it has progressed 2022-08-02 16:45:37 +02:00
Jonathan Kolb
f1f2a61dc8 Broadcast all calendar events while still honoring global and per-calendar maximumEntries 2022-07-03 13:17:18 -04:00
Sam Detweiler
1f4ac82495 add changelog for #2868 2022-06-28 08:05:13 -05:00
Sam Detweiler
0baf58f3fd fix regression calendar.maximumEntries not used 2022-06-28 08:01:28 -05:00
Jon Kolb
d588fab981 Don't adjust startDate for full day events if endDate is in the past 2022-03-02 22:09:15 -05:00
Kristjan SCHMIDT
a5668b1b99 Magic Mirror -> MagicMirror²
Consistent spelling
2022-01-26 23:09:26 +01:00
Jonathan Kolb
0aee42255f Return full list of events from createEventList for broadcasting 2022-01-17 10:07:12 -05:00
Sam Detweiler
fc14431147 fix date correction comparison for fulldate, just less than, not less or equal 2021-12-26 16:40:17 +01:00
Sam Detweiler
f75ca0c399 after prettier 2021-12-25 02:22:42 +11:00
Sam Detweiler
b3ef4b40c5 fix calendar across timezone, showEnd/FullDay 2021-12-25 02:10:48 +11:00
Julian Dinter
cfff2ad72b Changed comment regarding "ical.js" and "node-ical". 2021-08-25 17:28:37 +02:00
Julian Dinter
83b8cc6729 Ran npm run lint:prettier.. 2021-08-22 14:23:10 +02:00
Julian Dinter
878c0be727 [Fix] start time of calendar event gets corrected by time zone offset. 2021-08-22 14:16:02 +02:00
Julian Dinter
e7f06f5c0c Removed duplicated and thus superfluous debug messages. 2021-08-22 14:06:24 +02:00
Julian Dinter
a1fc38c5fe Prettified and added debug messages. 2021-08-22 13:57:24 +02:00
rejas
4b1c7da171 Update jsdoc 2021-05-19 11:12:56 +02:00
Sam Detweiler
d11e4e5c92 refix #2483 , recurring FULL Day event, start date before 2007 2021-03-23 08:44:14 -05:00
Sam Detweiler
2b940c9cfb fix formatting 2021-03-19 10:42:14 -05:00
Sam Detweiler
b6f4737ecc fix 2488, west of UTC day shift 2021-03-19 10:32:04 -05:00
Sam Detweiler
4f9fc032e5 fix for issue 2483, calendar shows wrong date, recurring start before 2007 2021-03-17 07:36:03 -05:00
rejas
d3d64d3ca0 Cleanups 2021-03-14 10:40:14 +01:00
rejas
c2f5d038de Move filter function into utils class too 2021-03-14 09:03:12 +01:00
rejas
0b37ed072c Refactor fetcher methods into util class 2021-03-14 08:53:40 +01:00