-
Notifications
You must be signed in to change notification settings - Fork 247
Replace DateTime with CalDateTime in RecurrencePatternEvaluator and related code
#742
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
Conversation
4af837a to
20323c8
Compare
|
Here are the remaining members of
Other:
|
41526ad to
b03ffe5
Compare
b03ffe5 to
2e78621
Compare
Replace instances of `DateTime` with `CalDateTime` across the codebase. Key updates include: - Remove the `CalDateTime implicit operator` for converstion of `DateTime` to `CalDateTime` - Modifying the Until property of `RecurrencePattern` to use `CalDateTime`. - Updating `ExceptionDates` to directly add `CalDateTime` instances. - Refactoring methods like `GetIso8601WeekOfYear` to accept `CalDateTime` parameters. - Adjusting serialization and deserialization processes for `CalDateTime`. - Adjusting the `RecurrencePatternEvaluator` to work with `CalDateTime`.
2e78621 to
dda621a
Compare
I'd say ideally most of them, especially the |
CalDateTime instead of DateTimeDateTime with CalDateTime in CalDateTime in RecurrencePatternEvaluator and related code
|
Gonna create another PR for |
DateTime with CalDateTime in CalDateTime in RecurrencePatternEvaluator and related codeDateTime with CalDateTime RecurrencePatternEvaluator and related code
DateTime with CalDateTime RecurrencePatternEvaluator and related codeDateTime with CalDateTime in RecurrencePatternEvaluator and related code
| /// in, according to the week numbering required by RFC 5545. | ||
| /// </summary> | ||
| private static DateTime GetStartOfWeek(this DateTime t, DayOfWeek firstDayOfWeek) | ||
| private static CalDateTime GetStartOfWeek(this CalDateTime t, DayOfWeek firstDayOfWeek) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also be DateOnly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
Yes, true, quite significant... You think the price is too high? v4.3.1Current MainPR #742Benchmark[MemoryDiagnoser]
public class RecurrenceBenchmark
{
private Calendar _calendar;
[GlobalSetup]
public void Setup()
{
_calendar = GenerateCalendarWithRecurrences();
}
private Calendar GenerateCalendarWithRecurrences()
{
var calendar = new Calendar();
var dailyEvent = new CalendarEvent
{
Start = new CalDateTime(2025, 3, 1),
End = null,
RecurrenceRules = new List<RecurrencePattern>
{
new RecurrencePattern(FrequencyType.Daily, 1) { Count = 1000 }
}
};
calendar.Events.Add(dailyEvent);
return calendar;
}
[Benchmark]
public void SerializeCalendar()
{
var serializer = new CalendarSerializer();
var serializedCalendar = serializer.SerializeToString(_calendar);
}
[Benchmark]
public void GetOccurrences()
{
var occurrences = _calendar.GetOccurrences().ToList();
}
} |
|
The problem with |
|
@minichma I was actually hesitating decreasing performance. |
|
@axunonb Great, always good to be confident by measuring things! |
|




Replace
DateTimewithCalDateTimeinRecurrencePatternEvaluatorand related code. Key changes:RecurrencePatternto useCalDateTime.ExceptionDatesto directly addCalDateTimeinstances.GetIso8601WeekOfYearto acceptCalDateTimeparameters.CalDateTime.RecurrencePatternEvaluatorto work withCalDateTime.