Spot the bug in the Date replacer

from JSON
Node 24 intermediate 4 min 1 issue to find

Find why this replacer never emits the intended tagged Date object.

JavaScript
const text = JSON.stringify(
  { placedAt: new Date('2026-09-04T10:30:00.000Z') },
  (key, value) => {
    if (value instanceof Date) {
      return { type: 'Date', value: value.toISOString() };
    }
    return value;
  },
);

console.log(text);
Open in playground
Report an error