#3230·dayjs

devHelper incorrectly warns that diff(0) has an invalid comparison date

Author: xu91102Created Sep 26, 2026Updated Sep 29, 2026

Describe the bug

With devHelper enabled, dayjs(1000).diff(0, 'second') correctly returns 1 but also emits Invalid usage: diff() requires a valid comparison date as the first argument. The numeric Unix epoch 0 is a valid comparison date.

Expected behavior

Do not warn for zero. Keep the existing warning for omitted or invalid comparison dates.

Information

  • Reproduced on dev 436bde0bcded312781cbe45dc2b0ef079a36d8e3, macOS / Node.js, Asia/Shanghai.
  • Existing devHelper suite passes; an epoch comparison regression fails on the unexpected warning.
  • Investigated with OpenAI Codex assistance.