Open Kukusik8 opened 1 month ago
const Timestamp = function (precision = 6) {
if (!type.int(precision)) precision = 6;
const p = precision;
const start = performance.timeOrigin; //undefined
const now = performance.now();
const iso = new Date(start + now).toISOString();
const microseconds = (((start + now) % 1000) / 1000).toFixed(p).slice(2);
return iso.substring(0, iso.indexOf('.') + 1) + microseconds + 'Z';
};
export default Timestamp;
Here my code. I use deployctl, don't use npm.
As a workaround you may define an approximate timeOrigin
(once) at the start of your entrypoint:
if (!performance.timeOrigin) {
Object.defineProperty(performance, 'timeOrigin', { value: Date.now() - performance.now() });
}
When i deploy my code on Deno Deploy, I have this error in the logs and it says "ERROR: RangeError: Invalid time value at Date.toISOString ()". It happens because of this line in my code
I've tried to use
Date.now()
instead ofperformance.timeOrigin
, and it worked. *Btwperformance.now()
working as well.Does someone know what is the possible solution? Deno on latest version.
It deployes successfully, but on Deno logs this error.
It happens here: