excid3 / simple_calendar

A wonderfully simple calendar gem for Rails
http://excid3.github.io/simple_calendar
MIT License
1.58k stars 268 forks source link

Show events only on certain days of the week #203

Closed edenisn closed 6 years ago

edenisn commented 6 years ago

Thanks for this gem!

How to show events only on certain days of the week (for example: monday and thuesday) in multi-event month calendar?

excid3 commented 6 years ago

@edenisn you can just put an if statement in your block to check what day of the week it is.

<%= month_calendar events: @meetings do |date, meetings| %>
  <%= date %>

  <% if date.monday? || date.thursday? %>
    <% meetings.each do |meeting| %>
      <div>
        <%= meeting.name %>
      </div>
    <% end %>
  <% end %>
<% end %>