Skip to content

Commit

Permalink
Fix month/year not updating when value changes
Browse files Browse the repository at this point in the history
  • Loading branch information
probablykasper committed Dec 12, 2022
1 parent 25d0a22 commit d0006fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Next
- Fix month/year not updating when `value` is assigned to

## 2.2.4 - 2022 Dec 1
- Fix buttons causing form submissions

Expand Down
3 changes: 3 additions & 0 deletions src/lib/DatePicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
/** The date shown in the popup when none is selected */
let browseDate = value ? cloneDate(value) : cloneDate(defaultDate)
$: if (browseDate.getTime() !== value?.getTime()) {
browseDate = value ? cloneDate(value) : browseDate
}
/** The earliest year the user can select */
export let min = new Date(defaultDate.getFullYear() - 20, 0, 1)
Expand Down

0 comments on commit d0006fc

Please sign in to comment.