react-native-worklets-core
react-native-worklets-core copied to clipboard
Date object not getting created
Here is a minimal example to reproduce -
const workletContext = Worklets.defaultContext;
workletContext.runAsync(() => {
'worklet';
const day = '2021-09-01';
console.log('Day is', new Date(day));
});
Output:
Day is {}
Surprisingly, if I perform an operation such as const dateObj = new Date(day); console.log(dateObj.getTime()). It appears to be working fine.
I might be wrong, but I think the console log function just doesn't support multiple arguments in worklets.
Have you tried console.log(new Date(day).getTIme()) ?
So getTime() is generally working anywhere but even if I do
const d = new Date();
console.log(d);
This prints {}