GithubHelp home page GithubHelp logo

Comments (1)

spahnke avatar spahnke commented on June 28, 2024

The reason why we do the conversion in a component wise fashion is because V8 does use the IANA timezone database and C# does not. Leading to inherent discrepancies explained in #75 and #76 .

In order to have stable behavior across different locales, I recommend to avoid component-based Date conversion. Instead, it would be better to always have any .NET DateTime object first converted to UTC timestmp (locaized or not), an then use this timestamp to construct V8 Date constructor (it could be int64 value or ISOString).

I think that's basically what we tried with #55 IIRC which had the nasty bugs explained in the other two PRs.

The brute-force test was more or less an assurance for me while writing the conversion, that I don't miss any more edge cases where C# and V8 disagree. So it's not the best test anyway, especially since you can't fix a timezone while running a test. (See #76 for more timezones where the brute-force test was known to fail)

I do not pretend to understand this topic completely in all its details but this was the closest we could get. If you find a better solution where the existing tests still pass you're welcome to create a PR 🙇

from javascript.net.

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.