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

Add kind-aware DateTime guards #42

@safakgur

Description

@safakgur

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions