From 1f863eddc006d04935aac9046bfd1172a4282581 Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Fri, 15 Mar 2024 16:33:17 +0000 Subject: [PATCH] fix: ensure arguments are supported on all reactive Date methods --- .changeset/wise-dodos-tell.md | 5 +++++ packages/svelte/src/reactivity/date.js | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/wise-dodos-tell.md diff --git a/.changeset/wise-dodos-tell.md b/.changeset/wise-dodos-tell.md new file mode 100644 index 000000000000..55e477c9fc06 --- /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 eb1e72fcc9eb..8f55cf0ef8c7 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);