File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
packages/svelte/src/reactivity Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -32,9 +32,14 @@ export class SvelteDate extends Date {
32
32
if ( method . startsWith ( 'get' ) || method . startsWith ( 'to' ) ) {
33
33
// @ts -ignore
34
34
proto [ method ] = function ( ...args ) {
35
+ // If we have no params, then don't cache or create a derived
35
36
// @ts -ignore
36
- var can_cache = args . length === 0 ;
37
- var d = can_cache ? this . #deriveds. get ( method ) : undefined ;
37
+ if ( args . length > 0 ) {
38
+ get ( this . #time) ;
39
+ // @ts -ignore
40
+ return date_proto [ method ] . apply ( this , args ) ;
41
+ }
42
+ var d = this . #deriveds. get ( method ) ;
38
43
39
44
if ( d === undefined ) {
40
45
d = derived ( ( ) => {
@@ -43,9 +48,7 @@ export class SvelteDate extends Date {
43
48
return date_proto [ method ] . apply ( this , args ) ;
44
49
} ) ;
45
50
46
- if ( can_cache ) {
47
- this . #deriveds. set ( method , d ) ;
48
- }
51
+ this . #deriveds. set ( method , d ) ;
49
52
}
50
53
51
54
return get ( d ) ;
You can’t perform that action at this time.
0 commit comments