Skip to content

Support DateTimeOffset type #69

Closed
Closed

Description

@drhumlen

Description

We use DateTimeOffset for everything instead of regular DateTime since it maintains time zone information. Right now we have to |> List.map (fun datetimeoffset -> datetimeoffset.UtcDateTime) every time we chart up something.

Would it be possible to support DateTimeOffset directly?

Activity

  1. added this to the Backlog milestone on Apr 11, 2021
  2. kMutagene commented on Apr 11, 2021

    @kMutagene
    Collaborator

    Hi @drhumlen,

    The problem here is DateTimeOffset not implementing IConvertible while DateTime does. For me it seems like we would not really have much of a choice here other than implementing overloads for every single chart function on DateTimeOffset for that to work, which seems quite overkill for a use case that can be solved with a single mapping/conversion step. Implementing IConvertible for DateTimeOffset also seems to be not that trivial and might also be overkill on your side, so i am afraid I do not have any good idea to tackle this from our side atm. There might be a solution coming up though, depending on when and if erased union types become a thing in F#.

  3. drhumlen commented on Apr 12, 2021

    @drhumlen
    Author

    Aha. That makes sense. Yeah implementing overloads for every method seems like tedious work when everything else works fine with just IConvertible. I guess the best workaround for now is for us to make some helpers that converts a list of DateTimeOffset to DateTime.

  4. kMutagene commented on Apr 13, 2021

    @kMutagene
    Collaborator

    Cloosing for now, might be revisited when erased unions are a thing in F# so we could use things like (IConvertible|DateTimeOffset|SomeOtherType) as input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions