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

Disallow initializing CalDateTime from DateTimeKind.Local and some cleanup #704

Merged
merged 7 commits into from
Jan 23, 2025

Conversation

minichma
Copy link
Collaborator

@minichma minichma commented Jan 22, 2025

Significant efforts were made lately to reduce the ambiguity that comes from dealing with System.DateTime with DateTimeKind.Local. The latter refers to the system's local time zone, which is not something that ical.net is aware of and wants to deal with. This PR cleans up some of the remaining places where DateTimeKind.Local could still appear and dissallows initializing CalDateTime instances with a DateTime of kind Local.

It also changes the parameters of IEvaluator.Evaluate() from System.DateTime to IDateTime to avoid ambiguity and does some other minor cleanup.

Fixes #406

Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
Ical.Net/Evaluation/PeriodListEvaluator.cs 0% 1 Missing ⚠️
Ical.Net/Evaluation/TimeZoneInfoEvaluator.cs 0% 1 Missing ⚠️
Ical.Net/Evaluation/TodoEvaluator.cs 50% 0 Missing and 1 partial ⚠️

Impacted file tree graph

@@         Coverage Diff         @@
##           main   #704   +/-   ##
===================================
  Coverage    65%    65%           
===================================
  Files       103    103           
  Lines      4660   4658    -2     
  Branches   1119   1128    +9     
===================================
+ Hits       3025   3027    +2     
+ Misses     1203   1198    -5     
- Partials    432    433    +1     
Files with missing lines Coverage Δ
Ical.Net/DataTypes/CalDateTime.cs 89% <100%> (+1%) ⬆️
Ical.Net/Evaluation/Evaluator.cs 91% <ø> (+5%) ⬆️
Ical.Net/Evaluation/EventEvaluator.cs 88% <ø> (ø)
Ical.Net/Evaluation/RecurrencePatternEvaluator.cs 74% <100%> (-<1%) ⬇️
Ical.Net/Evaluation/RecurrenceUtil.cs 92% <100%> (ø)
Ical.Net/Evaluation/RecurringEvaluator.cs 92% <ø> (+5%) ⬆️
Ical.Net/Evaluation/PeriodListEvaluator.cs 27% <0%> (ø)
Ical.Net/Evaluation/TimeZoneInfoEvaluator.cs 14% <0%> (ø)
Ical.Net/Evaluation/TodoEvaluator.cs 65% <50%> (-3%) ⬇️

}

public abstract IEnumerable<Period> Evaluate(IDateTime referenceDate, DateTime? periodStart, DateTime? periodEnd, bool includeReferenceDateInResults);
public abstract IEnumerable<Period> Evaluate(IDateTime referenceDate, IDateTime? periodStart, IDateTime? periodEnd, bool includeReferenceDateInResults);
Copy link
Collaborator

@axunonb axunonb Jan 23, 2025

Choose a reason for hiding this comment

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

nullable arguments should have #nullable enable. The effort shouldn't be too big? Otherwise I could just do that in another PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh yes. It actually wasn't my intention to introduce nullable, but now that it's already there, I tried to enable #nullable for the affected files :-D I'm not using it too much, so please have a close look!

axunonb
axunonb previously approved these changes Jan 23, 2025
Copy link
Collaborator

@axunonb axunonb left a comment

Choose a reason for hiding this comment

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

See some minor remarks. Very good!

@minichma minichma force-pushed the work/minichma/feature/evaluator_caldatetime branch from b781cd3 to 3db7dea Compare January 23, 2025 15:07
Copy link
Collaborator

@axunonb axunonb left a comment

Choose a reason for hiding this comment

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

LGTM - thanks again!

@minichma minichma merged commit c8f791c into main Jan 23, 2025
7 of 8 checks passed
@minichma minichma deleted the work/minichma/feature/evaluator_caldatetime branch January 23, 2025 19:09
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

Successfully merging this pull request may close these issues.

RecurrencePatternEvaluator treats DTSTART and UNTIL timezones incorrectly
2 participants