tsndr / cloudflare-worker-jwt

A lightweight JWT implementation with ZERO dependencies for Cloudflare Workers.
MIT License
680 stars 55 forks source link

reminder about Date.now() on cloudflare worker #21

Closed he-yang closed 2 years ago

he-yang commented 2 years ago

While reading https://developers.cloudflare.com/workers/runtime-apis/web-standards/

it was noted that Date.now() returns the time of the last I/O; it does not advance during code execution.

A reminder to consider this in your code.

tsndr commented 2 years ago

I don't think that it matters too much.

How else would we determine the current time otherwise?

he-yang commented 2 years ago

I was writting some scripts requires getting current time on Cloudflare worker, and noted this special information from offical documentation.

Havn't figured out any good solutions. Hope someone can provide nice alternative.

tsndr commented 2 years ago

I think it's very unlikely that this will become an issue, also there's not really another viable alternative.

@he-yang Thanks for the headsup :)