diff --git a/.changeset/wise-dodos-tell.md b/.changeset/wise-dodos-tell.md new file mode 100644 index 0000000000..55e477c9fc --- /dev/null +++ b/.changeset/wise-dodos-tell.md @@ -0,0 +1,5 @@ +--- +"svelte": patch +--- + +fix: ensure arguments are supported on all reactive Date methods diff --git a/packages/svelte/src/reactivity/date.js b/packages/svelte/src/reactivity/date.js index eb1e72fcc9..8f55cf0ef8 100644 --- a/packages/svelte/src/reactivity/date.js +++ b/packages/svelte/src/reactivity/date.js @@ -68,16 +68,16 @@ export class ReactiveDate extends Date { for (const method of read) { // @ts-ignore - proto[method] = function () { + proto[method] = function (...args) { get(this.#raw_time); // @ts-ignore - return date_proto[method].call(this); + return date_proto[method].apply(this, args); }; } for (const method of write) { // @ts-ignore - proto[method] = function (/** @type {any} */ ...args) { + proto[method] = function (...args) { // @ts-ignore const v = date_proto[method].apply(this, args); const time = date_proto.getTime.call(this);