Skip to content
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

[Feature Request] {{ Calendar - events: ad a specific CSS class according to expression or condition }} #3738

Open
4 tasks done
SimoneMSR opened this issue Mar 7, 2025 · 3 comments

Comments

@SimoneMSR
Copy link

Prerequisites

  • I am running the latest version of MagicMirror², and know that this feature is not available now.
  • I know my issue is not related to a third-party module.
  • I have searched for existing issues that already include this feature request, without success.

Describe the Feature Request

I would like to customize the calendar so to apply specific CSS to events, via config.js, or via a module method, or notification.

Describe the Use Case

Say that I can add the class "past" to all past events, I could hide past events in the original calendar widget, but still have them rendered in the CalendarExt3 (which uses broadcasts from calendar module)

Describe Preferred Solution

config.js

....calendars: [
    {
      name : "my_calendar"
      url: "...",
      cssClasses : {
        past : "e.startDate < new Date()"
      }
    }
}

using a module method:

MM.getModules().find(m=>m.name=="calendar").setStyleCallback(event=>{
  var classes = {}
  classes.past = event.startDate < new Date()
  return classes
})

using a module motification:

myModule.sendNotification("calendar_setStyleCallback", {callback : event=>{
  var classes = {}
  classes.past = event.startDate < new Date()
  return classes
}})

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

Participation

  • I am willing to submit a pull request for this change.
@sdetweil
Copy link
Collaborator

sdetweil commented Mar 7, 2025

how is this different from customEvents?

@sdetweil
Copy link
Collaborator

sdetweil commented Mar 7, 2025

you can also modify another modules content in code

@SimoneMSR
Copy link
Author

I guess customEvents configuration cannot access the startDate of an event. Am I right?

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

No branches or pull requests

2 participants