#3236·dayjs

objectSupport manipulation methods throw on nullish arguments

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

Installing objectSupport changes core arithmetic/setter behavior for nullish arguments into a TypeError:

javascript
dayjs.extend(objectSupport);
dayjs('2026-09-26').add(null, 'day'); // throws reading null.constructor
dayjs('2026-09-26').add(undefined, 'day'); // throws
dayjs('2026-09-26').set(null, 1); // throws

Without objectSupport, null arithmetic adds zero, undefined arithmetic returns an invalid date, and nullish setter units are ignored. The plugin should pass these non-object inputs to the original methods. Subtract is affected too. This concerns the manipulation wrappers, distinct from the previously fixed null-date parsing issue #2208.

Reproduced on dev with Node 22.23.2, macOS. Prepared with Codex assistance.