DateTimeAxis.ToDateTime doesn't behave as intended in .NET 8 · Issue #2061 · oxyplot/oxyplot · GitHub
Skip to content

DateTimeAxis.ToDateTime doesn't behave as intended in .NET 8 #2061

@VisualMelon

Description

@VisualMelon

A DateTimeAxis with a step that required a reciprocating representation (e.g. 4hours = 1/6) results in unintended tick values.

image

I can't reproduce this with .NET Framework or .NET 6; observed it with .NET 7 also.

From the immediate window (across two debug sessions, one with .NET 7 and the other net framework 462):

DateTimeAxis.ToDateTime(45334.166666666664).ToString()
"12/02/2024 03:59:59"
DateTimeAxis.ToDateTime(45334.166666666664).ToString()
"12/02/2024 04:00:00"

I assume this is because of https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/7.0/datetime-add-precision where millisecond rounding was removed.

I don't have a suggestion for a fix this minute, but will try to work out a workaround soon for typical use-cases (probably just putting the implicit rounding back in).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions