Skip to content

Show events of a configurable amount of past days#3046

Merged
rejas merged 5 commits intoMagicMirrorOrg:developfrom
Tom-Hirschberger:develop
Feb 21, 2023
Merged

Show events of a configurable amount of past days#3046
rejas merged 5 commits intoMagicMirrorOrg:developfrom
Tom-Hirschberger:develop

Conversation

@Tom-Hirschberger
Copy link
Contributor

Hi,

want to include a birthday calendar to my mirror which shows upcoming birthdays and as a reminder birthdays of the last two days.
I used MMM-CalendarExt2 for this job in the past but the module is not supported any more and very complicated to configure.
I managed to style the default calendar module to my needs but what i am missing is to display already past events within a configurable time range.

I included the translations of "YESTERDAY" and "DAYBEFOREYESTERDAY" to all translation files and modified the code to accept a new option pastDaysCount which controls of how many days past events should be displayed.

@codecov-commenter
Copy link

Codecov Report

Merging #3046 (e8f0c3f) into develop (bf28e63) will increase coverage by 0.09%.
The diff coverage is 21.27%.

📣 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    #3046      +/-   ##
===========================================
+ Coverage    22.91%   23.01%   +0.09%     
===========================================
  Files           52       52              
  Lines        11543    11577      +34     
===========================================
+ Hits          2645     2664      +19     
- Misses        8898     8913      +15     
Impacted Files Coverage Δ
modules/default/clock/clock.js 0.00% <0.00%> (ø)
modules/default/calendar/calendar.js 34.18% <28.57%> (-0.18%) ⬇️
modules/default/updatenotification/node_helper.js 90.27% <0.00%> (+12.50%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Collaborator

@rejas rejas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice PR, just would be nice to have some tests

{
"LOADING": "Loading …",

"YESTERDAY": "Yesterday",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, what are english displays showing then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They will show "Yesterday" like "Today" for today

…AfterTomorrow" css classes in calender_spec.js
@sdetweil
Copy link
Collaborator

I'm not fond of this pr. we should leave this to extension modules and not try to jam past events into the default display.

have enough calendar problems as it is

@@ -1,6 +1,7 @@
{
"LOADING": "Besig om te laai …",

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that some languages are missing DAYBEFOREYESTERDAY?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no useful translation for "DAYBEFOREYESTERDAY" and "DAYAFTERTOMORROW" in some languages. The calendar module takes care of these exceptions for "DAYAFTERTOMORROW" already.
I adapted the mechanism to "DAYBEFOREYESTERDAY"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay, thanks for the explanation!

I think this PR is a useful addition to the standard module 🙂

@rejas
Copy link
Collaborator

rejas commented Feb 20, 2023

I agree with you that the calendar module is bloated / full-of-old-code etc

But this PR seems small and straightforward enough IMO to be merged. No weird edge cases or so... I am in favor of merging. Whats your take @khassel ?

@khassel
Copy link
Collaborator

khassel commented Feb 20, 2023

It's a valid usecase so I will not block a merge. But on the other side it does not simplify the code. Because it is implemented as a new option it hopefully will not increase support.

@sdetweil
Copy link
Collaborator

sdetweil commented Feb 20, 2023

it will increase support. layout, colors,. blah blah..

I don't see how a few days in the past helps the birthday list issue...

@Tom-Hirschberger
Copy link
Contributor Author

Tom-Hirschberger commented Feb 21, 2023

Hi, i can understand the concerns about increasing amount of support with increasing amount of features.
What i do not understand is why the introduction of past events (with only a small amount of changes needed) will increase the support amount for colors and the basic layout.

My birthday list issue is solved with this changes as anything else is styling i can do with CSS.
I want to see birthdays i forgot in the last days.

@sdetweil
Copy link
Collaborator

based on past experience. more than one someone will want these past events formatted differently than current. and will want more, and might want them after the upcoming

@Tom-Hirschberger
Copy link
Contributor Author

@sdetweil I wrote a transformer for MMM-CalenderExt3Agend today and did some hardcore CSS restyling to the module. As the module displays past events in default it is okay for me if do not want to merge the pull request.

But i will need to open a issue as the default calender module broadcasts the birthday as monthly events instead of yearly.

@sdetweil
Copy link
Collaborator

sdetweil commented Feb 21, 2023

monthly vs yearly. but they are yearly..... why mangle the data

@rejas rejas merged commit a237691 into MagicMirrorOrg:develop Feb 21, 2023
@rejas
Copy link
Collaborator

rejas commented Feb 21, 2023

Merging it since the majority seems to be in favor of it.

@rejas
Copy link
Collaborator

rejas commented Feb 21, 2023

Could you please create a PR with the next options for the documentation page https://github.com/MichMich/MagicMirror-Documentation

@Tom-Hirschberger ?

@Tom-Hirschberger
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants