cloudflare / cloudflare/workerd

🐛 BUG: pre-io Date.now() behaviour inconsistent with live runtime

Open
#3,567 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

### Which Cloudflare product(s) does this pertain to?

Miniflare

### What version(s) of the tool(s) are you using?

wrangler 3.64.0

### What version of Node are you using?

v20.14.0

### What operating system and version are you using?

Mac Sonoma 14.5

### Describe the Bug

### Observed behavior
Calling `Date.now()` before io (for example in the root of a module) returns the current time instead of returning `0` as it does in the live runtime.

### Expected behavior
It should behave the same as `Date.now()` in the live runtime, returning `0`

### Steps to reproduce
`console.log(Date.now())` at the root of any worker and run locally.

### Please provide a link to a minimal reproduction

_No response_

### Please provide any relevant error logs

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.