Comments (4)
Just for clarity, a simpler example of the parsing bug:
new Date('2019-08-07T00:00:00.5Z')
gives 2019-08-07T00:00:00.005Z
5 milliseconds is wrong, should be 500 milliseconds
from hermes.
Thanks for the bug report. We'll work on fixing this.
from hermes.
Just in case someone would like to find a JavaScript workaround for the bug, here is mine (I don't pretend it's universal, but it can be a starting point for others to wait for your fix instead of simply avoiding to use Hermes).
Just call that once at app startup:
if (__DEV__ || (new Date('2019-08-07T00:00:00.5Z')).getMilliseconds() === 5) {
const millisDate = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d+)Z$/
const _Date = Date;
function MockDate(y, m, d, h, M, s, ms) {
let date = undefined;
switch (arguments.length) {
case 0: return new _Date();
case 1:
if (typeof y === 'string') {
const matches = y.match(millisDate);
if (matches) {
const [_, yy, mm, dd, hh, MM, ss, mmss] = matches;
const fixed = Math.floor(new Number('.' + mmss) * 1000);
const fixedStr = `${fixed}`.padStart(3, '0');
return new _Date(`${yy}-${mm}-${dd}T${hh}:${MM}:${ss}.${fixed}Z`);
}
}
return new _Date(y);
default: return new _Date(y, m, d, h, M, s, ms);
}
}
Object.setPrototypeOf(MockDate, _Date);
Date = MockDate;
}
from hermes.
Fixed in a084c4d
from hermes.
Related Issues (20)
- Performance regression traversing large arrays compared to other engines HOT 4
- Hermes 0.7.2 : Max heap size was exceeded HOT 4
- hermes eslint: No sourceCode in context HOT 6
- Bug: recursion: "Maximum call stack size exceeded" HOT 2
- Wrong `DCMAKE_TOOLCHAIN_FILE` in docs HOT 3
- Intl.NumberFormat can't always display the number's sign HOT 1
- Intl.NumberFormat with compact notation doesn't display formatting HOT 1
- Examples how to use the experimental C ABI? HOT 3
- babel-plugin-syntax-hermes-parser drops chunk names HOT 1
- static_h: Assertion `Val && "isa<> used on a null pointer"' failed with -typed on tsc.js HOT 2
- fatal: unable to access 'http://github.com/facebook/hermes.git/' HOT 2
- I hope Static Hermes supported Windows, Linux, and MacOS. HOT 2
- Local debug and release build throws a type error HOT 3
- I hope it was possible for Static Hermes to native AOT compile all the existing NPM modules. HOT 1
- Intl.DateTimeFormat does not support 'Europe/Kyiv' timezone HOT 2
- It would be good for Static Hermes if it could use pure JavaScript code(that has no type annotations) with automatic type guessing like "var" code in Dart, or ":=" in Go. HOT 7
- Using Intl with standalone Hermes app HOT 2
- Support for top level await HOT 1
- iphoneos framework very large size issue (build-apple-framework.sh) HOT 2
- [Debugger] Incorrect scope variable information for variable initialized in for-loop HOT 3
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 hermes.