feat: display static periods of time #872
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective of the PR :
In my use-case, I've got events occurring over a few days.
For those specific events, I want to be able to show a view with a specific design for the start day, a specific design for the end day, and a specific design for the in-between.
Content of the PR :
To achieve what I needed, I re-used the logic you implemented with the "Range Selection".
You can now add the parameter
highlightedPeriods
, which takes a list ofPeriod
objects (which is just holding a start date and an end date).Those
highlightedPeriod
will be displayed as followsEnregistrement.de.l.ecran.2024-05-03.a.14.53.17.mov
I think that the "Range Selection" is more important than displaying those events occurring over a few days : for this reason, during the Range Selection, the design of the calendar is overwritten by the design declared for the Range Selection.
Everything can be customized thanks to the
CalendarStyle
and theCalendarBuilders
parameters.I didn't modify a lot of existing code, it shouldn't impact any of the current users, and I added some tests.
The tests are mainly here to securise the
Period
object : I wrote an algorithm which job is to merge the overlapping periods that the user can pass as a parameter to the Calendar, easing the display process.