Skip to content

Conversation

@stopfstedt
Copy link
Member

@stopfstedt stopfstedt commented Nov 7, 2025

fixes ilios/ilios#6631

couple of notes:

  • calendarStartDate and calendarEndDate are derived values and should really be getters. as a follow-up, make event objects based on an actual class, rather than using a plain JS object. then, we can make these attrs actual getters.
  • in our test coverage, it is currently not possible to retrieve the start/end date and -time of events on the calendar via cli page objects. i think this can be rectified by adding data-test- attrs to the event notes in the calendar grid that would carry this information, which would allow us to the read them back out during testing. another follow-up item.

@netlify
Copy link

netlify bot commented Nov 7, 2025

Deploy Preview for ilios-frontend ready!

Name Link
🔨 Latest commit 8a77b54
🔍 Latest deploy log https://app.netlify.com/projects/ilios-frontend/deploys/691277acb899150008a53c81
😎 Deploy Preview https://deploy-preview-8940--ilios-frontend.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@stopfstedt stopfstedt force-pushed the 6631-ilm-calendar-display branch 2 times, most recently from fcdd859 to 6820286 Compare November 8, 2025 00:53
these new attrs default to the given event's start- and end-date.
for end-of-day ILMs, these attrs are calculated, in order to make them
presentable in a calendar grid.
… offering calendars.

since we're dealing with offering-based events only here, we can default
these attrs to startDate and endDate directly. no edge-case logic
needed.
@stopfstedt stopfstedt force-pushed the 6631-ilm-calendar-display branch 2 times, most recently from f337fef to a00793f Compare November 10, 2025 22:49
@stopfstedt stopfstedt force-pushed the 6631-ilm-calendar-display branch from a00793f to 8a77b54 Compare November 10, 2025 23:39
@stopfstedt stopfstedt marked this pull request as ready for review November 10, 2025 23:45
Copy link
Member

@jrjohnson jrjohnson left a comment

Choose a reason for hiding this comment

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

I'm good with this as an iterative change and it solves the problem nicely. I'm in full agreement that another refactor is needed for the Event. There are too many places where we're faking the shape of the object in both app and test code. We're also having to create luxon objects with the same data many times in many places and sometimes reading the original data as well for sorting and display. All this could be eased significantly with a base class that was more complete.

// Multi-days are currently not shown in the calendar, instead they are displayed in a table below the calendar.
// To prevent this from happening, we pin the calendar display start-date to 11:45p and the end-date to 11:59p.
// [ST 2025/11/07]
const startDate = DateTime.fromISO(obj.startDate);
Copy link
Member

Choose a reason for hiding this comment

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

Readability tweak: could this be inside the if block and then, since it is ilm only in there, be dueDate. Because it's confusing on the next couple of lines to be doing startDate.set, even though luxon treats set as returning a new instance of the value, it's hard to read it that way. Looks like you're just setting a value on startDate twice.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, no probably not because then the hour and minute would be missing. Leaving this comment in anyway, wonder if there is a better luxon API to use here. Or if set doesn't mean to everyone else what it feels like to me?

obj.isUserEvent = isUserEvent;

// The start and end date of the event, for display purposes on the calendar. See comment block below.
obj.calendarStartDate = obj.startDate;
Copy link
Member

Choose a reason for hiding this comment

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

I like this rename, in the followup to this when we build events as classes we should also drop outside access to startDate and endDate if possible.

@jrjohnson jrjohnson removed the request for review from michaelchadwick November 12, 2025 05:24
Copy link
Member

@dartajax dartajax left a comment

Choose a reason for hiding this comment

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

works for me

@dartajax dartajax added the run ui tests Run the expensive UI tests label Nov 12, 2025
@dartajax dartajax merged commit 72ba893 into ilios:master Nov 14, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run ui tests Run the expensive UI tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

calendar - prevent end-of-day ILM-based event from turning into multi-day events

3 participants