Create new
Bindings
Transitions
Animations
Easing
Component composition
Context API
Special elements
Module context
Debugging
Miscellaneous
App.svelte
runes
This component is in runes mode.
To disable runes mode, add the following to the top of your component:
<svelte:options runes={false} />
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
⌄
<script>
const ONE_DAY = 24 * 60 * 60 * 1000;
let min = '2024-12-01';
let max = '2024-12-24';
let christmas = new Date('2024-12-25');
let date = $state(new Date());
let remaining = $derived(Math.ceil((christmas - date) / ONE_DAY));
</script>
<div>
<input
type="date"
min={min}
max={max}
bind:value={
() => {
// turn into the YYYY-MM-DD format expected by the input
return date.toISOString().slice(0, 10);
},
(v) => {
// validate the input (the `min`/`max` attributes only
// work for the calendar popup, not text entry)...
if (v < min) v = min;
if (v > max) v = max;
// ...and transform the YYYY-MM-DD string into a date
date = new Date(v);
}
}
/>
<p>{remaining} {remaining === 1 ? 'day' : 'days'} to go until Christmas!</p>
</div>
Error compiling component
WebAssembly.instantiateStreaming(): value type opcode @+13
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
⌄
⌄
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal/client";
var root = $.template(`<div class="svelte-xe1asu"><input type="date" class="svelte-xe1asu"> <p> </p></div>`);
export default function App($$anchor, $$props) {
$.push($$props, true);
const ONE_DAY = 24 * 60 * 60 * 1000;
let min = '2024-12-01';
let max = '2024-12-24';
let christmas = new Date('2024-12-25');
let date = $.state($.proxy(new Date()));
let remaining = $.derived(() => Math.ceil((christmas - $.get(date)) / ONE_DAY));
var div = root();
var input = $.child(div);
$.remove_input_defaults(input);
$.set_attribute(input, "min", min);
$.set_attribute(input, "max", max);
var p = $.sibling(input, 2);
var text = $.child(p);
$.reset(p);
$.reset(div);
$.template_effect(() => $.set_text(text, `${$.get(remaining) ?? ""} ${($.get(remaining) === 1 ? 'day' : 'days') ?? ""} to go until Christmas!`));
$.bind_value(
input,
() => {
// turn into the YYYY-MM-DD format expected by the input
return $.get(date).toISOString().slice(0, 10);
},
(v) => {
// validate the input (the `min`/`max` attributes only
result = svelte.compile(source, {
generate: ,
});99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
›
div.svelte-xe1asu {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: radial-gradient(at center, green, darkgreen);
color: Canvas;
font-size: min(2em, 4vw);
}
input.svelte-xe1asu {
font: inherit;
font-size: 2em;
border-radius: 0.2em;
padding: 0 0.2em;
border: none;
background: Canvas;
color: CanvasText;
}
Root {
css: StyleSheet {...}
- type: "StyleSheet"
- start: 807
- end: 1254
- attributes: []
children: [...] (2)
Rule {...}
- type: "Rule"
prelude: SelectorList {...}
- type: "SelectorList"
- start: 816
- end: 819
children: [...] (1)
ComplexSelector {...}
- type: "ComplexSelector"
- start: 816
- end: 819
children: [...] (1)
RelativeSelector {...}
- type: "RelativeSelector"
- combinator: null
selectors: [...] (1)
TypeSelector {...}
- type: "TypeSelector"
- name: "div"
- start: 816
- end: 819
}
]- start: 816
- end: 819
}
]
}
]
}block: Block {...}
- type: "Block"
- start: 820
- end: 1094
children: [...] (12)
Declaration {...}
- type: "Declaration"
- start: 824
- end: 839
- property: "position"
- value: "fixed"
} Declaration {...}
- type: "Declaration"
- start: 843
- end: 850
- property: "left"
- value: "0"
} Declaration {...}
- type: "Declaration"
- start: 854
- end: 860
- property: "top"
- value: "0"
} Declaration {...}
- type: "Declaration"
- start: 864
- end: 875
- property: "width"
- value: "100%"
} Declaration {...}
- type: "Declaration"
- start: 879
- end: 891
- property: "height"
- value: "100%"
} Declaration {...}
- type: "Declaration"
- start: 895
- end: 908
- property: "display"
- value: "flex"
} Declaration {...}
- type: "Declaration"
- start: 912
- end: 934
- property: "flex-direction"
- value: "column"
} Declaration {...}
- type: "Declaration"
- start: 938
- end: 957
- property: "align-items"
- value: "center"
} Declaration {...}
- type: "Declaration"
- start: 961
- end: 984
- property: "justify-content"
- value: "center"
} Declaration {...}
- type: "Declaration"
- start: 988
- end: 1044
- property: "background"
- value: "radial-gradient(at center, green, darkgreen)"
} Declaration {...}
- type: "Declaration"
- start: 1049
- end: 1062
- property: "color"
- value: "Canvas"
} Declaration {...}
- type: "Declaration"
- start: 1066
- end: 1090
- property: "font-size"
- value: "min(2em, 4vw)"
}
]
}- start: 816
- end: 1094
} Rule {...}
- type: "Rule"
prelude: SelectorList {...}
- type: "SelectorList"
- start: 1097
- end: 1102
children: [...] (1)
ComplexSelector {...}
- type: "ComplexSelector"
- start: 1097
- end: 1102
children: [...] (1)
RelativeSelector {...}
- type: "RelativeSelector"
- combinator: null
selectors: [...] (1)
TypeSelector {...}
- type: "TypeSelector"
- name: "input"
- start: 1097
- end: 1102
}
]- start: 1097
- end: 1102
}
]
}
]
}block: Block {...}
- type: "Block"
- start: 1103
- end: 1245
children: [...] (7)
Declaration {...}
- type: "Declaration"
- start: 1107
- end: 1120
- property: "font"
- value: "inherit"
} Declaration {...}
- type: "Declaration"
- start: 1124
- end: 1138
- property: "font-size"
- value: "2em"
} Declaration {...}
- type: "Declaration"
- start: 1142
- end: 1162
- property: "border-radius"
- value: "0.2em"
} Declaration {...}
- type: "Declaration"
- start: 1166
- end: 1182
- property: "padding"
- value: "0 0.2em"
} Declaration {...}
- type: "Declaration"
- start: 1186
- end: 1198
- property: "border"
- value: "none"
} Declaration {...}
- type: "Declaration"
- start: 1202
- end: 1220
- property: "background"
- value: "Canvas"
} Declaration {...}
- type: "Declaration"
- start: 1224
- end: 1241
- property: "color"
- value: "CanvasText"
}
]
}- start: 1097
- end: 1245
}
]content: {...}
- start: 814
- end: 1246
- styles: "\n\tdiv {\n\t\tposition: fixed;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tbackground: radial-gradient(at center, green, darkgreen);\t\n\t\tcolor: Canvas;\n\t\tfont-size: min(2em, 4vw);\n\t}\n\n\tinput {\n\t\tfont: inherit;\n\t\tfont-size: 2em;\n\t\tborder-radius: 0.2em;\n\t\tpadding: 0 0.2em;\n\t\tborder: none;\n\t\tbackground: Canvas;\n\t\tcolor: CanvasText;\n\t}\n"
- comment: null
}
}- js: []
- start: 252
- end: 805
- type: "Root"
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (3)
Text {...}
- type: "Text"
- start: 250
- end: 252
- raw: "\n\n"
- data: "\n\n"
} RegularElement {...}
- type: "RegularElement"
- start: 252
- end: 805
- name: "div"
attributes: [...] (1)
Attribute {...}
- type: "Attribute"
- start: -1
- end: -1
- name: "class"
value: [...] (1)
Text {...}
- type: "Text"
- data: "svelte-xe1asu"
- raw: "svelte-xe1asu"
- start: -1
- end: -1
}
]
}
]fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (5)
Text {...}
- type: "Text"
- start: 257
- end: 259
- raw: "\n\t"
- data: "\n\t"
} RegularElement {...}
- type: "RegularElement"
- start: 259
- end: 718
- name: "input"
attributes: [...] (5)
Attribute {...}
- type: "Attribute"
- start: 268
- end: 279
- name: "type"
value: [...] (1)
Text {...}
- start: 274
- end: 278
- type: "Text"
- raw: "date"
- data: "date"
}
]
} Attribute {...}
- type: "Attribute"
- start: 282
- end: 291
- name: "min"
value: ExpressionTag {...}
- type: "ExpressionTag"
- start: 286
- end: 291
expression: Identifier {...}
- type: "Identifier"
- start: 287
- end: 290
loc: {...}
start: {...}
- line: 15
- column: 7
}end: {...}
- line: 15
- column: 10
}
}- name: "min"
}
}
} Attribute {...}
- type: "Attribute"
- start: 294
- end: 303
- name: "max"
value: ExpressionTag {...}
- type: "ExpressionTag"
- start: 298
- end: 303
expression: Identifier {...}
- type: "Identifier"
- start: 299
- end: 302
loc: {...}
start: {...}
- line: 16
- column: 7
}end: {...}
- line: 16
- column: 10
}
}- name: "max"
}
}
} BindDirective {...}
- start: 306
- end: 714
- type: "BindDirective"
- name: "value"
expression: SequenceExpression {...}
- type: "SequenceExpression"
- start: 322
- end: 710
loc: {...}
start: {...}
- line: 18
- column: 3
}end: {...}
- line: 30
- column: 4
}
}expressions: [...] (2)
ArrowFunctionExpression {...}
- type: "ArrowFunctionExpression"
- start: 322
- end: 439
loc: {...}
start: {...}
- line: 18
- column: 3
}end: {...}
- line: 21
- column: 4
}
}- id: null
- expression: false
- generator: false
- async: false
- params: []
body: BlockStatement {...}
- type: "BlockStatement"
- start: 328
- end: 439
loc: {...}
start: {...}
- line: 18
- column: 9
}end: {...}
- line: 21
- column: 4
}
}body: [...] (1)
ReturnStatement {...}
- type: "ReturnStatement"
- start: 395
- end: 434
loc: {...}
start: {...}
- line: 20
- column: 4
}end: {...}
- line: 20
- column: 43
}
}argument: CallExpression {...}
- type: "CallExpression"
- start: 402
- end: 433
loc: {...}
start: {...}
- line: 20
- column: 11
}end: {...}
- line: 20
- column: 42
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 402
- end: 426
loc: {...}
start: {...}
- line: 20
- column: 11
}end: {...}
- line: 20
- column: 35
}
}object: CallExpression {...}
- type: "CallExpression"
- start: 402
- end: 420
loc: {...}
start: {...}
- line: 20
- column: 11
}end: {...}
- line: 20
- column: 29
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 402
- end: 418
loc: {...}
start: {...}
- line: 20
- column: 11
}end: {...}
- line: 20
- column: 27
}
}object: Identifier {...}
- type: "Identifier"
- start: 402
- end: 406
loc: {...}
start: {...}
- line: 20
- column: 11
}end: {...}
- line: 20
- column: 15
}
}- name: "date"
}property: Identifier {...}
- type: "Identifier"
- start: 407
- end: 418
loc: {...}
start: {...}
- line: 20
- column: 16
}end: {...}
- line: 20
- column: 27
}
}- name: "toISOString"
}- computed: false
- optional: false
}- arguments: []
- optional: false
}property: Identifier {...}
- type: "Identifier"
- start: 421
- end: 426
loc: {...}
start: {...}
- line: 20
- column: 30
}end: {...}
- line: 20
- column: 35
}
}- name: "slice"
}- computed: false
- optional: false
}arguments: [...] (2)
Literal {...}
- type: "Literal"
- start: 427
- end: 428
loc: {...}
start: {...}
- line: 20
- column: 36
}end: {...}
- line: 20
- column: 37
}
}- value: 0
- raw: "0"
} Literal {...}
- type: "Literal"
- start: 430
- end: 432
loc: {...}
start: {...}
- line: 20
- column: 39
}end: {...}
- line: 20
- column: 41
}
}- value: 10
- raw: "10"
}
]- optional: false
}leadingComments: [...] (1)
Line {...}
- type: "Line"
- value: " turn into the YYYY-MM-DD format expected by the input"
- start: 334
- end: 390
}
]
}
]
}
} ArrowFunctionExpression {...}
- type: "ArrowFunctionExpression"
- start: 444
- end: 710
loc: {...}
start: {...}
- line: 22
- column: 3
}end: {...}
- line: 30
- column: 4
}
}- id: null
- expression: false
- generator: false
- async: false
params: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 445
- end: 446
loc: {...}
start: {...}
- line: 22
- column: 4
}end: {...}
- line: 22
- column: 5
}
}- name: "v"
}
]body: BlockStatement {...}
- type: "BlockStatement"
- start: 451
- end: 710
loc: {...}
start: {...}
- line: 22
- column: 10
}end: {...}
- line: 30
- column: 4
}
}body: [...] (3)
IfStatement {...}
- type: "IfStatement"
- start: 571
- end: 592
loc: {...}
start: {...}
- line: 25
- column: 4
}end: {...}
- line: 25
- column: 25
}
}test: BinaryExpression {...}
- type: "BinaryExpression"
- start: 575
- end: 582
loc: {...}
start: {...}
- line: 25
- column: 8
}end: {...}
- line: 25
- column: 15
}
}left: Identifier {...}
- type: "Identifier"
- start: 575
- end: 576
loc: {...}
start: {...}
- line: 25
- column: 8
}end: {...}
- line: 25
- column: 9
}
}- name: "v"
}- operator: "<"
right: Identifier {...}
- type: "Identifier"
- start: 579
- end: 582
loc: {...}
start: {...}
- line: 25
- column: 12
}end: {...}
- line: 25
- column: 15
}
}- name: "min"
}
}consequent: ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 584
- end: 592
loc: {...}
start: {...}
- line: 25
- column: 17
}end: {...}
- line: 25
- column: 25
}
}expression: AssignmentExpression {...}
- type: "AssignmentExpression"
- start: 584
- end: 591
loc: {...}
start: {...}
- line: 25
- column: 17
}end: {...}
- line: 25
- column: 24
}
}- operator: "="
left: Identifier {...}
- type: "Identifier"
- start: 584
- end: 585
loc: {...}
start: {...}
- line: 25
- column: 17
}end: {...}
- line: 25
- column: 18
}
}- name: "v"
}right: Identifier {...}
- type: "Identifier"
- start: 588
- end: 591
loc: {...}
start: {...}
- line: 25
- column: 21
}end: {...}
- line: 25
- column: 24
}
}- name: "min"
}
}
}- alternate: null
leadingComments: [...] (2)
Line {...}
- type: "Line"
- value: " validate the input (the `min`/`max` attributes only"
- start: 457
- end: 511
} Line {...}
- type: "Line"
- value: " work for the calendar popup, not text entry)..."
- start: 516
- end: 566
}
]
} IfStatement {...}
- type: "IfStatement"
- start: 597
- end: 618
loc: {...}
start: {...}
- line: 26
- column: 4
}end: {...}
- line: 26
- column: 25
}
}test: BinaryExpression {...}
- type: "BinaryExpression"
- start: 601
- end: 608
loc: {...}
start: {...}
- line: 26
- column: 8
}end: {...}
- line: 26
- column: 15
}
}left: Identifier {...}
- type: "Identifier"
- start: 601
- end: 602
loc: {...}
start: {...}
- line: 26
- column: 8
}end: {...}
- line: 26
- column: 9
}
}- name: "v"
}- operator: ">"
right: Identifier {...}
- type: "Identifier"
- start: 605
- end: 608
loc: {...}
start: {...}
- line: 26
- column: 12
}end: {...}
- line: 26
- column: 15
}
}- name: "max"
}
}consequent: ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 610
- end: 618
loc: {...}
start: {...}
- line: 26
- column: 17
}end: {...}
- line: 26
- column: 25
}
}expression: AssignmentExpression {...}
- type: "AssignmentExpression"
- start: 610
- end: 617
loc: {...}
start: {...}
- line: 26
- column: 17
}end: {...}
- line: 26
- column: 24
}
}- operator: "="
left: Identifier {...}
- type: "Identifier"
- start: 610
- end: 611
loc: {...}
start: {...}
- line: 26
- column: 17
}end: {...}
- line: 26
- column: 18
}
}- name: "v"
}right: Identifier {...}
- type: "Identifier"
- start: 614
- end: 617
loc: {...}
start: {...}
- line: 26
- column: 21
}end: {...}
- line: 26
- column: 24
}
}- name: "max"
}
}
}- alternate: null
} ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 686
- end: 705
loc: {...}
start: {...}
- line: 29
- column: 4
}end: {...}
- line: 29
- column: 23
}
}expression: AssignmentExpression {...}
- type: "AssignmentExpression"
- start: 686
- end: 704
loc: {...}
start: {...}
- line: 29
- column: 4
}end: {...}
- line: 29
- column: 22
}
}- operator: "="
left: Identifier {...}
- type: "Identifier"
- start: 686
- end: 690
loc: {...}
start: {...}
- line: 29
- column: 4
}end: {...}
- line: 29
- column: 8
}
}- name: "date"
}right: NewExpression {...}
- type: "NewExpression"
- start: 693
- end: 704
loc: {...}
start: {...}
- line: 29
- column: 11
}end: {...}
- line: 29
- column: 22
}
}callee: Identifier {...}
- type: "Identifier"
- start: 697
- end: 701
loc: {...}
start: {...}
- line: 29
- column: 15
}end: {...}
- line: 29
- column: 19
}
}- name: "Date"
}arguments: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 702
- end: 703
loc: {...}
start: {...}
- line: 29
- column: 20
}end: {...}
- line: 29
- column: 21
}
}- name: "v"
}
]
}
}leadingComments: [...] (1)
Line {...}
- type: "Line"
- value: " ...and transform the YYYY-MM-DD string into a date"
- start: 628
- end: 681
}
]
}
]
}
}
]
}- modifiers: []
} Attribute {...}
- type: "Attribute"
- start: -1
- end: -1
- name: "class"
value: [...] (1)
Text {...}
- type: "Text"
- data: "svelte-xe1asu"
- raw: "svelte-xe1asu"
- start: -1
- end: -1
}
]
}
]fragment: Fragment {...}
- type: "Fragment"
- nodes: []
}
} Text {...}
- type: "Text"
- start: 718
- end: 722
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 722
- end: 798
- name: "p"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (4)
ExpressionTag {...}
- type: "ExpressionTag"
- start: 725
- end: 736
expression: Identifier {...}
- type: "Identifier"
- start: 726
- end: 735
loc: {...}
start: {...}
- line: 34
- column: 5
}end: {...}
- line: 34
- column: 14
}
}- name: "remaining"
}
} Text {...}
- type: "Text"
- start: 736
- end: 737
- raw: " "
- data: " "
} ExpressionTag {...}
- type: "ExpressionTag"
- start: 737
- end: 771
expression: ConditionalExpression {...}
- type: "ConditionalExpression"
- start: 738
- end: 770
loc: {...}
start: {...}
- line: 34
- column: 17
}end: {...}
- line: 34
- column: 49
}
}test: BinaryExpression {...}
- type: "BinaryExpression"
- start: 738
- end: 753
loc: {...}
start: {...}
- line: 34
- column: 17
}end: {...}
- line: 34
- column: 32
}
}left: Identifier {...}
- type: "Identifier"
- start: 738
- end: 747
loc: {...}
start: {...}
- line: 34
- column: 17
}end: {...}
- line: 34
- column: 26
}
}- name: "remaining"
}- operator: "==="
right: Literal {...}
- type: "Literal"
- start: 752
- end: 753
loc: {...}
start: {...}
- line: 34
- column: 31
}end: {...}
- line: 34
- column: 32
}
}- value: 1
- raw: "1"
}
}consequent: Literal {...}
- type: "Literal"
- start: 756
- end: 761
loc: {...}
start: {...}
- line: 34
- column: 35
}end: {...}
- line: 34
- column: 40
}
}- value: "day"
- raw: "'day'"
}alternate: Literal {...}
- type: "Literal"
- start: 764
- end: 770
loc: {...}
start: {...}
- line: 34
- column: 43
}end: {...}
- line: 34
- column: 49
}
}- value: "days"
- raw: "'days'"
}
}
} Text {...}
- type: "Text"
- start: 771
- end: 794
- raw: " to go until Christmas!"
- data: " to go until Christmas!"
}
]
}
} Text {...}
- type: "Text"
- start: 798
- end: 799
- raw: "\n"
- data: "\n"
}
]
}
} Text {...}
- type: "Text"
- start: 805
- end: 807
- raw: "\n\n"
- data: "\n\n"
}
]
}- options: null
instance: Script {...}
- type: "Script"
- start: 0
- end: 250
- context: "default"
content: Program {...}
- type: "Program"
- start: 8
- end: 241
loc: {...}
start: {...}
- line: 1
- column: 0
}end: {...}
- line: 10
- column: 0
}
}body: [...] (6)
VariableDeclaration {...}
- type: "VariableDeclaration"
- start: 10
- end: 46
loc: {...}
start: {...}
- line: 2
- column: 1
}end: {...}
- line: 2
- column: 37
}
}declarations: [...] (1)
VariableDeclarator {...}
- type: "VariableDeclarator"
- start: 16
- end: 45
loc: {...}
start: {...}
- line: 2
- column: 7
}end: {...}
- line: 2
- column: 36
}
}id: Identifier {...}
- type: "Identifier"
- start: 16
- end: 23
loc: {...}
start: {...}
- line: 2
- column: 7
}end: {...}
- line: 2
- column: 14
}
}- name: "ONE_DAY"
}init: BinaryExpression {...}
- type: "BinaryExpression"
- start: 26
- end: 45
loc: {...}
start: {...}
- line: 2
- column: 17
}end: {...}
- line: 2
- column: 36
}
}left: BinaryExpression {...}
- type: "BinaryExpression"
- start: 26
- end: 38
loc: {...}
start: {...}
- line: 2
- column: 17
}end: {...}
- line: 2
- column: 29
}
}left: BinaryExpression {...}
- type: "BinaryExpression"
- start: 26
- end: 33
loc: {...}
start: {...}
- line: 2
- column: 17
}end: {...}
- line: 2
- column: 24
}
}left: Literal {...}
- type: "Literal"
- start: 26
- end: 28
loc: {...}
start: {...}
- line: 2
- column: 17
}end: {...}
- line: 2
- column: 19
}
}- value: 24
- raw: "24"
}- operator: "*"
right: Literal {...}
- type: "Literal"
- start: 31
- end: 33
loc: {...}
start: {...}
- line: 2
- column: 22
}end: {...}
- line: 2
- column: 24
}
}- value: 60
- raw: "60"
}
}- operator: "*"
right: Literal {...}
- type: "Literal"
- start: 36
- end: 38
loc: {...}
start: {...}
- line: 2
- column: 27
}end: {...}
- line: 2
- column: 29
}
}- value: 60
- raw: "60"
}
}- operator: "*"
right: Literal {...}
- type: "Literal"
- start: 41
- end: 45
loc: {...}
start: {...}
- line: 2
- column: 32
}end: {...}
- line: 2
- column: 36
}
}- value: 1000
- raw: "1000"
}
}
}
]- kind: "const"
} VariableDeclaration {...}
- type: "VariableDeclaration"
- start: 49
- end: 72
loc: {...}
start: {...}
- line: 4
- column: 1
}end: {...}
- line: 4
- column: 24
}
}declarations: [...] (1)
VariableDeclarator {...}
- type: "VariableDeclarator"
- start: 53
- end: 71
loc: {...}
start: {...}
- line: 4
- column: 5
}end: {...}
- line: 4
- column: 23
}
}id: Identifier {...}
- type: "Identifier"
- start: 53
- end: 56
loc: {...}
start: {...}
- line: 4
- column: 5
}end: {...}
- line: 4
- column: 8
}
}- name: "min"
}init: Literal {...}
- type: "Literal"
- start: 59
- end: 71
loc: {...}
start: {...}
- line: 4
- column: 11
}end: {...}
- line: 4
- column: 23
}
}- value: "2024-12-01"
- raw: "'2024-12-01'"
}
}
]- kind: "let"
} VariableDeclaration {...}
- type: "VariableDeclaration"
- start: 74
- end: 97
loc: {...}
start: {...}
- line: 5
- column: 1
}end: {...}
- line: 5
- column: 24
}
}declarations: [...] (1)
VariableDeclarator {...}
- type: "VariableDeclarator"
- start: 78
- end: 96
loc: {...}
start: {...}
- line: 5
- column: 5
}end: {...}
- line: 5
- column: 23
}
}id: Identifier {...}
- type: "Identifier"
- start: 78
- end: 81
loc: {...}
start: {...}
- line: 5
- column: 5
}end: {...}
- line: 5
- column: 8
}
}- name: "max"
}init: Literal {...}
- type: "Literal"
- start: 84
- end: 96
loc: {...}
start: {...}
- line: 5
- column: 11
}end: {...}
- line: 5
- column: 23
}
}- value: "2024-12-24"
- raw: "'2024-12-24'"
}
}
]- kind: "let"
} VariableDeclaration {...}
- type: "VariableDeclaration"
- start: 99
- end: 138
loc: {...}
start: {...}
- line: 6
- column: 1
}end: {...}
- line: 6
- column: 40
}
}declarations: [...] (1)
VariableDeclarator {...}
- type: "VariableDeclarator"
- start: 103
- end: 137
loc: {...}
start: {...}
- line: 6
- column: 5
}end: {...}
- line: 6
- column: 39
}
}id: Identifier {...}
- type: "Identifier"
- start: 103
- end: 112
loc: {...}
start: {...}
- line: 6
- column: 5
}end: {...}
- line: 6
- column: 14
}
}- name: "christmas"
}init: NewExpression {...}
- type: "NewExpression"
- start: 115
- end: 137
loc: {...}
start: {...}
- line: 6
- column: 17
}end: {...}
- line: 6
- column: 39
}
}callee: Identifier {...}
- type: "Identifier"
- start: 119
- end: 123
loc: {...}
start: {...}
- line: 6
- column: 21
}end: {...}
- line: 6
- column: 25
}
}- name: "Date"
}arguments: [...] (1)
Literal {...}
- type: "Literal"
- start: 124
- end: 136
loc: {...}
start: {...}
- line: 6
- column: 26
}end: {...}
- line: 6
- column: 38
}
}- value: "2024-12-25"
- raw: "'2024-12-25'"
}
]
}
}
]- kind: "let"
} VariableDeclaration {...}
- type: "VariableDeclaration"
- start: 142
- end: 172
loc: {...}
start: {...}
- line: 8
- column: 1
}end: {...}
- line: 8
- column: 31
}
}declarations: [...] (1)
VariableDeclarator {...}
- type: "VariableDeclarator"
- start: 146
- end: 171
loc: {...}
start: {...}
- line: 8
- column: 5
}end: {...}
- line: 8
- column: 30
}
}id: Identifier {...}
- type: "Identifier"
- start: 146
- end: 150
loc: {...}
start: {...}
- line: 8
- column: 5
}end: {...}
- line: 8
- column: 9
}
}- name: "date"
}init: CallExpression {...}
- type: "CallExpression"
- start: 153
- end: 171
loc: {...}
start: {...}
- line: 8
- column: 12
}end: {...}
- line: 8
- column: 30
}
}callee: Identifier {...}
- type: "Identifier"
- start: 153
- end: 159
loc: {...}
start: {...}
- line: 8
- column: 12
}end: {...}
- line: 8
- column: 18
}
}- name: "$state"
}arguments: [...] (1)
NewExpression {...}
- type: "NewExpression"
- start: 160
- end: 170
loc: {...}
start: {...}
- line: 8
- column: 19
}end: {...}
- line: 8
- column: 29
}
}callee: Identifier {...}
- type: "Identifier"
- start: 164
- end: 168
loc: {...}
start: {...}
- line: 8
- column: 23
}end: {...}
- line: 8
- column: 27
}
}- name: "Date"
}- arguments: []
}
]- optional: false
}
}
]- kind: "let"
} VariableDeclaration {...}
- type: "VariableDeclaration"
- start: 174
- end: 240
loc: {...}
start: {...}
- line: 9
- column: 1
}end: {...}
- line: 9
- column: 67
}
}declarations: [...] (1)
VariableDeclarator {...}
- type: "VariableDeclarator"
- start: 178
- end: 239
loc: {...}
start: {...}
- line: 9
- column: 5
}end: {...}
- line: 9
- column: 66
}
}id: Identifier {...}
- type: "Identifier"
- start: 178
- end: 187
loc: {...}
start: {...}
- line: 9
- column: 5
}end: {...}
- line: 9
- column: 14
}
}- name: "remaining"
}init: CallExpression {...}
- type: "CallExpression"
- start: 190
- end: 239
loc: {...}
start: {...}
- line: 9
- column: 17
}end: {...}
- line: 9
- column: 66
}
}callee: Identifier {...}
- type: "Identifier"
- start: 190
- end: 198
loc: {...}
start: {...}
- line: 9
- column: 17
}end: {...}
- line: 9
- column: 25
}
}- name: "$derived"
}arguments: [...] (1)
CallExpression {...}
- type: "CallExpression"
- start: 199
- end: 238
loc: {...}
start: {...}
- line: 9
- column: 26
}end: {...}
- line: 9
- column: 65
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 199
- end: 208
loc: {...}
start: {...}
- line: 9
- column: 26
}end: {...}
- line: 9
- column: 35
}
}object: Identifier {...}
- type: "Identifier"
- start: 199
- end: 203
loc: {...}
start: {...}
- line: 9
- column: 26
}end: {...}
- line: 9
- column: 30
}
}- name: "Math"
}property: Identifier {...}
- type: "Identifier"
- start: 204
- end: 208
loc: {...}
start: {...}
- line: 9
- column: 31
}end: {...}
- line: 9
- column: 35
}
}- name: "ceil"
}- computed: false
- optional: false
}arguments: [...] (1)
BinaryExpression {...}
- type: "BinaryExpression"
- start: 209
- end: 237
loc: {...}
start: {...}
- line: 9
- column: 36
}end: {...}
- line: 9
- column: 64
}
}left: BinaryExpression {...}
- type: "BinaryExpression"
- start: 210
- end: 226
loc: {...}
start: {...}
- line: 9
- column: 37
}end: {...}
- line: 9
- column: 53
}
}left: Identifier {...}
- type: "Identifier"
- start: 210
- end: 219
loc: {...}
start: {...}
- line: 9
- column: 37
}end: {...}
- line: 9
- column: 46
}
}- name: "christmas"
}- operator: "-"
right: Identifier {...}
- type: "Identifier"
- start: 222
- end: 226
loc: {...}
start: {...}
- line: 9
- column: 49
}end: {...}
- line: 9
- column: 53
}
}- name: "date"
}
}- operator: "/"
right: Identifier {...}
- type: "Identifier"
- start: 230
- end: 237
loc: {...}
start: {...}
- line: 9
- column: 57
}end: {...}
- line: 9
- column: 64
}
}- name: "ONE_DAY"
}
}
]- optional: false
}
]- optional: false
}
}
]- kind: "let"
}
]- sourceType: "module"
}- attributes: []
}
}
The AST is not public API and may change at any point in time