Skip to content

Fix showing end dates when meetings have multiple dates#16288

Merged
alecslupu merged 8 commits intodevelopfrom
fix/multiple-dates-meetings-card
Mar 4, 2026
Merged

Fix showing end dates when meetings have multiple dates#16288
alecslupu merged 8 commits intodevelopfrom
fix/multiple-dates-meetings-card

Conversation

@andreslucena
Copy link
Copy Markdown
Member

@andreslucena andreslucena commented Mar 2, 2026

🎩 What? Why?

When a meeting has multiple dates (i.e. the end date doesn't match with the day/month of the start date), then we don't show the end date in the card view (like in the content blocks or in the index page).

This PR fixes this, and does two minor related changes:

  • clean-up the logic used for this in the show page, as it was not idiomatic in my opinion (or saying it in another way, a bit ugly)
  • make the margins/separations a bit less

📌 Related Issues

Testing

  1. Scroll in the homepage with the "Upcoming meetings" content block (enabled by default in the seeds)
  2. Go to http://localhost:3000/meetings/

📷 Screenshots

Before

image image image

After

image image image

♥️ Thank you!

Summary by CodeRabbit

  • Improvements

    • Smarter meeting date display: full month names when spanning months, abbreviated otherwise; end dates and separators shown only when different from starts; markup updated for clearer conditional rendering.
  • Style

    • Calendar header made wider for readability; adjusted calendar alignment and separator spacing; tightened list card spacing.
  • Tests

    • Added rendering tests for single-day, multi-day, cross-month, and open-ended meetings.

@andreslucena andreslucena added the type: fix PRs that implement a fix for a bug label Mar 2, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 2, 2026

📝 Walkthrough

Walkthrough

Reworks meeting calendar markup and styles to conditionally render end month/day only when different from start; adds helpers to detect same month/day; adjusts calendar width and spacing; updates tests to cover single-day, multi-day same-month, multi-month, and no-end-time cases.

Changes

Cohort / File(s) Summary
Core styles
decidim-core/app/packs/stylesheets/decidim/_cards.scss
Adjusted calendar sizing and spacing: increased header width, added .card__list-content, &--wide modifier and &-separator rule; changed alignment and small spacing tweaks.
Meetings styles
decidim-meetings/app/packs/stylesheets/decidim/meetings/_item.scss
Changed calendar alignment to justify-center and updated separator margin (mx-4).
Meeting view templates
decidim-meetings/app/cells/decidim/meetings/meeting_l/image.erb, decidim-meetings/app/cells/decidim/meetings/dates_and_map/show.erb
Rewrote calendar markup into nested month/day/year blocks; render full or abbreviated month based on sameness; render end-month/day only when different; moved separators into dedicated elements; apply card__calendar--wide when spanning multiple days/months.
Cell helpers
decidim-meetings/app/cells/decidim/meetings/meeting_l_cell.rb
Added private predicates same_month? and same_day? to treat blank end_time as same and compare start/end dates.
Specs
decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb
Expanded tests to assert presence/absence of separators, wide class, and correct start/end month/day for single-day, multi-day same-month, multi-month, and no-end-time scenarios.

Sequence Diagram(s)

(Skipped — changes are view/markup and styling with small helper predicates; no multi-component sequential flow requiring visualization.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related issues

  • #9801 — Meeting card not displaying range dates when multiple dates — This PR adds conditional end-date rendering and separators addressing the missing end date on cards.
  • Critical multi-day meeting display issues #15719 — Similar meeting calendar rendering changes (views and helpers); modifications appear aligned with that issue's objectives.

Poem

🐰 I hopped through months and days with care,
Placed tiny dashes in the air.
When dates don't match, I show the end,
Aligned the cards — a rabbit's mend.
Tap the calendar — see friends!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Fix showing end dates when meetings have multiple dates' clearly and concisely summarizes the main change: fixing the display of end dates on meeting cards with multiple dates.
Linked Issues check ✅ Passed The PR implements all requirements from issue #9801: it adds end date display to meeting cards for multi-date meetings across card views (content blocks and index pages), addressing the specific bug where end dates were missing.
Out of Scope Changes check ✅ Passed All changes are within scope: UI/template updates to display end dates, helper methods to check date matching, styling adjustments for the new layout, and comprehensive test coverage for the functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/multiple-dates-meetings-card

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@andreslucena andreslucena changed the title Fix/multiple dates meetings card Fix showing end dates when meetings have multiple dates Mar 2, 2026
github-actions[bot]
github-actions bot previously approved these changes Mar 2, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb (1)

65-107: Please add a cross-year date-range regression spec.

Current scenarios cover same-month and cross-month in the same year, but not a range like 2020-10-152021-10-17. Adding it will lock the intended behavior for year boundaries.

Suggested spec addition
+    context "when meeting spans the same month across different years" do
+      let!(:meeting) { create(:meeting, :published, start_time: Time.new(2020, 10, 15, 10, 0, 0, 0), end_time: Time.new(2021, 10, 17, 12, 0, 0, 0)) }
+
+      it "shows the range instead of collapsing into a single date" do
+        expect(subject).to have_css(".card__calendar--wide")
+        expect(subject).to have_css(".card__calendar-day", text: "15")
+        expect(subject).to have_css(".card__calendar-day", text: "17")
+      end
+    end
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb` around
lines 65 - 107, Add a new spec context in meeting_l_cell_spec.rb named something
like "when meeting spans years" that creates a published meeting with start_time
Time.new(2020,10,15,10,0,0) and end_time Time.new(2021,10,17,12,0,0) (use the
same let!(:meeting) pattern), then assert via subject that the start month and
end month are rendered (expect(subject).to have_css(".card__calendar-month",
text: "Oct") for both start and end), that start and end days render
(".card__calendar-day" with "15" and "17"), and that the view shows the month
separator (".meeting__calendar-separator") and the wide calendar class
(".card__calendar--wide"); use the same selectors and test style as the existing
cross-month context so the regression locks cross-year behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@decidim-meetings/app/cells/decidim/meetings/meeting_l_cell.rb`:
- Around line 39-49: The same_month? and same_day? methods compare only
month/day and therefore misclassify meetings spanning year boundaries; update
both methods (same_month? and same_day?) to compare full dates or include year
in the comparison (e.g., compare meeting.start_time.to_date ==
meeting.end_time.to_date for day, or compare start_time.year == end_time.year &&
start_time.month == end_time.month for month) while preserving the existing
early-return when meeting.end_time.blank?. Ensure you reference
meeting.start_time and meeting.end_time in the new comparisons.

In `@decidim-meetings/app/cells/decidim/meetings/meeting_l/image.erb`:
- Around line 5-13: In meeting_l/image.erb the separator <p> uses two different
CSS classes (meeting__calendar-separator and card__calendar-separator), causing
inconsistent styling; standardize them by changing the first separator's class
(the <p> between the month outputs that currently reads
meeting__calendar-separator) to card__calendar-separator so both separators use
the same class in this card__calendar template.

---

Nitpick comments:
In `@decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb`:
- Around line 65-107: Add a new spec context in meeting_l_cell_spec.rb named
something like "when meeting spans years" that creates a published meeting with
start_time Time.new(2020,10,15,10,0,0) and end_time Time.new(2021,10,17,12,0,0)
(use the same let!(:meeting) pattern), then assert via subject that the start
month and end month are rendered (expect(subject).to
have_css(".card__calendar-month", text: "Oct") for both start and end), that
start and end days render (".card__calendar-day" with "15" and "17"), and that
the view shows the month separator (".meeting__calendar-separator") and the wide
calendar class (".card__calendar--wide"); use the same selectors and test style
as the existing cross-month context so the regression locks cross-year behavior.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe25803 and e02fe16.

📒 Files selected for processing (6)
  • decidim-core/app/packs/stylesheets/decidim/_cards.scss
  • decidim-meetings/app/cells/decidim/meetings/dates_and_map/show.erb
  • decidim-meetings/app/cells/decidim/meetings/meeting_l/image.erb
  • decidim-meetings/app/cells/decidim/meetings/meeting_l_cell.rb
  • decidim-meetings/app/packs/stylesheets/decidim/meetings/_item.scss
  • decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb

github-actions[bot]
github-actions bot previously approved these changes Mar 3, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 3, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 3, 2026
github-actions[bot]
github-actions bot previously approved these changes Mar 3, 2026
@andreslucena andreslucena force-pushed the fix/multiple-dates-meetings-card branch from 7678f6d to 61adc64 Compare March 3, 2026 10:18
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb (1)

92-94: ⚠️ Potential issue | 🟠 Major

Fix selector mismatch in the no-end-time separator assertion

On Line 93, the spec checks .meeting__calendar-separator, but the card template uses .card__calendar-separator. This can let regressions pass undetected.

Proposed fix
-      it "does not show separator" do
-        expect(subject).to have_no_css(".meeting__calendar-separator")
-      end
+      it "does not show separator" do
+        expect(subject).to have_no_css(".card__calendar-separator")
+      end
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb` around
lines 92 - 94, The spec's expectation in the "it does not show separator"
example is using the wrong CSS selector; update the assertion in the example
(the block under it "does not show separator" that calls expect(subject).to
have_no_css(...)) to check for ".card__calendar-separator" instead of
".meeting__calendar-separator" so it matches the card template's class; keep the
rest of the test (subject, example name) unchanged.
🧹 Nitpick comments (2)
decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb (1)

52-54: Make the “no month separator” assertion explicit

The example title says no month separator, but it only checks month text. Add a scoped absence check to match the intent.

Proposed refinement
       it "does not show month separator" do
         expect(subject).to have_css(".card__calendar-month", text: "October")
+        expect(subject).to have_no_css(".card__calendar-month .card__calendar-separator")
       end
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb` around
lines 52 - 54, The spec example "it 'does not show month separator'" currently
only asserts the month text; update the example to explicitly assert the absence
of the month-separator element by adding a scoped negative matcher against the
separator element (for example: expect(subject).not_to
have_css(".card__calendar-month + .card__calendar-month-separator") or
expect(subject).not_to have_css(".card__calendar-month-separator") alongside the
existing expect(subject).to have_css(".card__calendar-month", text: "October")
so the test both confirms the month is present and that no separator node is
rendered.
decidim-meetings/app/cells/decidim/meetings/meeting_l/image.erb (1)

2-18: Align with design system: replace <p> with <span> inside calendar components

The design system mockup uses <span> elements for all calendar content, but this template nests <p> inside <span> containers, which violates HTML content models. Update to use <span> throughout for consistency with the design system and correct semantic structure.

Note: The CSS rule empty:[&>p]:hidden in _item.scss line 38 targets <p> elements and should be removed or updated after this change.

Proposed markup adjustment
   <span class="card__calendar-month">
-    <p><%= l(meeting.start_time, format: same_month? ? "%B" : "%b") %></p>
+    <span><%= l(meeting.start_time, format: same_month? ? "%B" : "%b") %></span>
     <% unless same_month? %>
-      <p class="card__calendar-separator">-</p>
-      <p><%= l(meeting.end_time, format: "%b") %></p>
+      <span class="card__calendar-separator">-</span>
+      <span><%= l(meeting.end_time, format: "%b") %></span>
     <% end %>
   </span>
   <span class="card__calendar-day">
-    <p><%= l(meeting.start_time, format: "%d") %></p>
+    <span><%= l(meeting.start_time, format: "%d") %></span>
     <% unless same_day? && same_month? %>
-      <p class="card__calendar-separator">-</p>
-      <p><%= l(meeting.end_time, format: "%d") %></p>
+      <span class="card__calendar-separator">-</span>
+      <span><%= l(meeting.end_time, format: "%d") %></span>
     <% end %>
   </span>
   <span class="card__calendar-year">
-    <p><%= l(meeting.start_time, format: "%Y") %></p>
+    <span><%= l(meeting.start_time, format: "%Y") %></span>
   </span>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@decidim-meetings/app/cells/decidim/meetings/meeting_l/image.erb` around lines
2 - 18, Replace the <p> elements inside the calendar component in the meeting_l
image cell with <span> elements to match the design system and correct HTML
semantics: update the template that renders meeting.start_time and
meeting.end_time (the block using same_month? and same_day? conditionals in
decidim/meetings/meeting_l/image.erb) so every displayed date/month/day/year
uses <span> instead of <p>, and then remove or adapt the CSS rule that targets
child <p> elements (the empty:[&>p]:hidden rule in _item.scss) to target the new
spans or be deleted.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb`:
- Around line 92-94: The spec's expectation in the "it does not show separator"
example is using the wrong CSS selector; update the assertion in the example
(the block under it "does not show separator" that calls expect(subject).to
have_no_css(...)) to check for ".card__calendar-separator" instead of
".meeting__calendar-separator" so it matches the card template's class; keep the
rest of the test (subject, example name) unchanged.

---

Nitpick comments:
In `@decidim-meetings/app/cells/decidim/meetings/meeting_l/image.erb`:
- Around line 2-18: Replace the <p> elements inside the calendar component in
the meeting_l image cell with <span> elements to match the design system and
correct HTML semantics: update the template that renders meeting.start_time and
meeting.end_time (the block using same_month? and same_day? conditionals in
decidim/meetings/meeting_l/image.erb) so every displayed date/month/day/year
uses <span> instead of <p>, and then remove or adapt the CSS rule that targets
child <p> elements (the empty:[&>p]:hidden rule in _item.scss) to target the new
spans or be deleted.

In `@decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb`:
- Around line 52-54: The spec example "it 'does not show month separator'"
currently only asserts the month text; update the example to explicitly assert
the absence of the month-separator element by adding a scoped negative matcher
against the separator element (for example: expect(subject).not_to
have_css(".card__calendar-month + .card__calendar-month-separator") or
expect(subject).not_to have_css(".card__calendar-month-separator") alongside the
existing expect(subject).to have_css(".card__calendar-month", text: "October")
so the test both confirms the month is present and that no separator node is
rendered.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c91e91b and 61adc64.

📒 Files selected for processing (3)
  • decidim-core/app/packs/stylesheets/decidim/_cards.scss
  • decidim-meetings/app/cells/decidim/meetings/meeting_l/image.erb
  • decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb
🚧 Files skipped from review as they are similar to previous changes (1)
  • decidim-core/app/packs/stylesheets/decidim/_cards.scss

Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

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

👍 - merging with Codecov failure.

@alecslupu alecslupu merged commit cc54905 into develop Mar 4, 2026
89 of 94 checks passed
@alecslupu alecslupu deleted the fix/multiple-dates-meetings-card branch March 4, 2026 21:55
@alecslupu alecslupu added release: v0.30 Issues or PRs that need to be tackled for v0.30 release: v0.31 Issues or PRs that need to be tackled for v0.31 labels Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: core module: meetings release: v0.30 Issues or PRs that need to be tackled for v0.30 release: v0.31 Issues or PRs that need to be tackled for v0.31 type: fix PRs that implement a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Meeting card not displaying range dates when multiple dates

2 participants