Coder Social home page Coder Social logo

Comments (7)

Zaid-Ajaj avatar Zaid-Ajaj commented on May 12, 2024 1

😉 No problem! I think you can leave the issue open, it would be a nice addition to have an overload that accepts DateTimeOffset[] and then convert to DateTime internally

from feliz.plotly.

nojaf avatar nojaf commented on May 12, 2024 1

Thanks, I've tested this and it works as expected.

from feliz.plotly.

Zaid-Ajaj avatar Zaid-Ajaj commented on May 12, 2024

I probably can convert my DateTimeOffset to a DateTime, though I'm not really sure how to proceed there.

You can get the DateTime component using the DateTime property

let timestamp = DateTimeOffset.Now;
let date = timestamp.DateTime;

In Fable, both DateTimeOffset and DateTime are Date instances so you could even unbox<DateTime>. The only difference is that DateTimeOffset attaches a property to the Date instance to maintain the offset

from feliz.plotly.

nojaf avatar nojaf commented on May 12, 2024

You lose the time information when calling timestamp.DateTime;.
https://fable.io/repl/#?code=PTAEHUCcEsBcFNQGMD2ATRLKgDYoIZqj6gDO+AtgA46IBmkKFZ0GARvpALABQKV8AHagAygE9SCCr14ARfAgAq0CvADydOqXiwAdAAVO2gBQAiAEwAGAIwBOALSWAzPesBWUJYDsALjfmfABZrXSd3SwjTAEpdeQReAB8APlAqGEFYOmFTAFIAQVMgA&html=Q&css=Q

from feliz.plotly.

Zaid-Ajaj avatar Zaid-Ajaj commented on May 12, 2024

The REPL snippet is calling .Date, not .DateTime which only returns the date component

from feliz.plotly.

nojaf avatar nojaf commented on May 12, 2024

😮, ok my bad. Thanks for pointing this out Zaid!

from feliz.plotly.

Shmew avatar Shmew commented on May 12, 2024

I just pushed version 2.1.0 that adds support for DateTimeOffset anywhere a DateTime was previously allowed. Let me know if you have any issues, and feel free to re-open this if so!

from feliz.plotly.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.