Comments (1)
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)
- Randomly throws exception for the same code
- Adopting this project HOT 8
- about run environment : Could not load file or assembly 'JavaScrip t.Net.dll' HOT 1
- Tabs or spaces for new code? HOT 1
- Run MathJax in C# using Javascript.Net HOT 1
- Proper prototype handling HOT 5
- JavascriptFunction.Call cannot be GC? HOT 1
- Extended Documentation or Wiki HOT 6
- Question: What will be the best way of implementing a good/real sleep() function? HOT 3
- Does it supports .net framework 4.6.1 and greater? Does it supports IE? HOT 1
- Warnings : Should I be concerned? HOT 2
- [QUESTION/REQUEST] Create JS function which calls C# APIs
- C++ Redistributable
- Passing C# field through javascript and back into C# results in null HOT 6
- Running Javascript.Net in a ASP.NET Web Applications HOT 6
- System.AccessViolationException HOT 4
- UnauthorizedAccessException when trying to open a mutex HOT 6
- Explain how to manipulate C# (CLR) objects from js and vice versa HOT 1
- Question: fetch/xmlhttprequest/http request OR run a local executable file HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javascript.net.