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

Refactor or remove IDateTime #646

Open
axunonb opened this issue Nov 21, 2024 · 0 comments
Open

Refactor or remove IDateTime #646

axunonb opened this issue Nov 21, 2024 · 0 comments

Comments

@axunonb
Copy link
Collaborator

axunonb commented Nov 21, 2024

  • Remove setters for HasDate, HasTilme, Value, TzId
  • change type of timeOnly nullable TimeOnly?
  • Make Date return DateOnly, remove DateOnlyValue form CalDateTime
  • Make Time return TimeOnly, remove TilmeOnlyValue form CalDateTime
  • Remove AsSystemLocal from IDateTime
@axunonb axunonb changed the title IDateTime: Remove setters for HasDate, HasTilme, Value, TzId Refactor or remove IDateTime Nov 21, 2024
axunonb added a commit to axunonb/ical.net that referenced this issue Nov 21, 2024
* `if (Math.Abs(right.TotalDays % 1) > AlmostZeroEpsilon)` is now `if ((right.Ticks % TimeSpan.TicksPerDay) != 0)`
* `DateUtil.DateTime GetSimpleDateTimeData(IDateTime dt)` returns `dt.Value`
* Move internal `DateUtil.SimpleDateTimeToMatch` as private to `RecurrenceTests`
* Move internal `DateUtil.MatchTimeZone` as private  to `RecurrencePatternEvaluator`
* Create tasks in ical-org#646 and ical-org#647 for new PRs
axunonb added a commit that referenced this issue Nov 25, 2024
* Enhance CalDateTime and DateTimeSerializer

* Introduced new methods and test cases in `CalDateTimeTests.cs` to ensure correct behavior of `CalDateTime` properties and methods.
* Updated various tests in `DeserializationTests.cs` and `RecurrenceTests.cs` to handle `CalDateTime` without time components and improve clarity.
* Refined `IsAllDay` property in `CalendarEvent.cs` and updated methods in `UniqueComponent.cs` and `VTimeZone.cs` to use `CalDateTime` with time components.
* Removed outdated comments and improved code formatting.
* Enabled nullable reference types and updated `IDateTime` interface.
* Added new methods and properties to `CalDateTime.cs` for better date and time management.
* Refactored methods in `Period`, `RecurrencePatternEvaluator`, and `RecurringEvaluator` classes to handle `HasTime` property correctly.
* Improved `DateTimeSerializer` class for better performance and handling of nullable types.
* Added XML documentation and marked obsolete methods.

Resolves #630
Resolves #633
Resolves #635
Resolves #636
Resolves #637

* Fix occasual failing unit test

Depending on the time offset from local time to UTC the tests failed.
Changed all date kinds to UTC.

* Make AlmostZeroEpsilon private const

* Replace DateTimeKind.Local with DateTimeKind.Unspecified

Affected classes:
* `CalDateTime`
* `DateUtil`
* `DateTimeSerializer`

* SOC: Move getting "TZID" from `IParameterCollection` to `DateTimeSerializer`

`CalDateTime.TzId` does no more read or write `CalDateTime.Parameters`

* Use backing fields `DateOnly` and `TimeOnly` to create the `CalDateTime.Value`

* Depending on `HasTime`, `Value` contains only the `DateTime.Date`, or the value including `DateTime.TimeOfDay`.
* The timezone dermines whether `DateTimeKind.Utc`or `DateTimeKind.Unspecified`will be used.

* Remove the redundant `Calendar` argument to CTORs

* Implement review comments

* `if (Math.Abs(right.TotalDays % 1) > AlmostZeroEpsilon)` is now `if ((right.Ticks % TimeSpan.TicksPerDay) != 0)`
* `DateUtil.DateTime GetSimpleDateTimeData(IDateTime dt)` returns `dt.Value`
* Move internal `DateUtil.SimpleDateTimeToMatch` as private to `RecurrenceTests`
* Move internal `DateUtil.MatchTimeZone` as private  to `RecurrencePatternEvaluator`
* Create tasks in #646 and #647 for new PRs

* Remove xmldoc for non-existing parameter "kind"

Also refactor for SonarCloud complaints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant