Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Add kind-aware DateTime guards #42

Closed
safakgur opened this issue Jan 9, 2020 · 1 comment
Closed

Add kind-aware DateTime guards #42

safakgur opened this issue Jan 9, 2020 · 1 comment
Milestone

Comments

@safakgur
Copy link
Owner

safakgur commented Jan 9, 2020

Split from #40

Default DateTime.Compare ignores the Kind property. We should:

  • Add a new guard, KindSpecified, to require a DateTime argument to have kind that is either Local or Utc, so people can force callers to think about the source of their time values and specify the kinds explicitly.
  • Add non-generic overloads to Equal, NotEqual, Min, Max and InRange that accept DateTime arguments and throw if (a.Kind == Unspecified) != (b.Kind == Unspecified) (DateTime already accounts for the time difference when comparing Local values to Utc values).

The second bullet is a breaking change, so I'm adding this to the 2.0 milestone.

@safakgur safakgur added this to the 2.0 milestone Jan 9, 2020
@safakgur safakgur changed the title Add KindSpecified guard for DateTime and make DateTime comparisons kind-aware Add kind-aware DateTime guards Jan 9, 2020
@safakgur safakgur reopened this Feb 18, 2020
@safakgur
Copy link
Owner Author

Won't do as the repo is being archived.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant