Skip to content

Commit f9704c0

Browse files
Fix assigning when value is null
1 parent 8d67dd9 commit f9704c0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/DatePicker.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323
function browse(d: Date) {
2424
browseDate = clamp(d, min, max)
25-
if (!browseWithoutSelecting) {
25+
if (!browseWithoutSelecting && value) {
2626
setValue(browseDate)
2727
}
2828
}
@@ -38,9 +38,9 @@
3838
/** The latest year the user can select */
3939
export let max = new Date(defaultDate.getFullYear(), 11, 31, 23, 59, 59, 999)
4040
$: if (value && value > max) {
41-
value = cloneDate(max)
41+
setValue(max)
4242
} else if (value && value < min) {
43-
value = cloneDate(min)
43+
setValue(min)
4444
}
4545
function clamp(d: Date, min: Date, max: Date) {
4646
if (browseDate > max) {

0 commit comments

Comments
 (0)