fix: ensure arguments are supported on all reactive Date methods (#10813)

pull/10817/head
Dominic Gannaway 10 months ago committed by GitHub
parent afc2eea382
commit 474fc7ebe0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: ensure arguments are supported on all reactive Date methods

@ -68,16 +68,16 @@ export class ReactiveDate extends Date {
for (const method of read) { for (const method of read) {
// @ts-ignore // @ts-ignore
proto[method] = function () { proto[method] = function (...args) {
get(this.#raw_time); get(this.#raw_time);
// @ts-ignore // @ts-ignore
return date_proto[method].call(this); return date_proto[method].apply(this, args);
}; };
} }
for (const method of write) { for (const method of write) {
// @ts-ignore // @ts-ignore
proto[method] = function (/** @type {any} */ ...args) { proto[method] = function (...args) {
// @ts-ignore // @ts-ignore
const v = date_proto[method].apply(this, args); const v = date_proto[method].apply(this, args);
const time = date_proto.getTime.call(this); const time = date_proto.getTime.call(this);

Loading…
Cancel
Save