Skip to content

Commit

Permalink
Fix bug with range pickers without pre-selected dates
Browse files Browse the repository at this point in the history
  • Loading branch information
t-lock committed Aug 20, 2024
1 parent acad354 commit c7bb577
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/DatePicker.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script>
import Popover from './Popover.svelte'
import { dayjs } from './lib/date-utils'
import { contextKey, setup } from './lib/context'
import { createEventDispatcher, setContext, getContext } from 'svelte'
import { createEventDispatcher, getContext, setContext } from 'svelte'
import { CalendarStyle } from '../calendar-style.js'
import { contextKey, setup } from './lib/context'
import { dayjs } from './lib/date-utils'
import { createViewContext } from './lib/view-context.js'
import Popover from './Popover.svelte'
import Toolbar from './Toolbar.svelte'
import View from './view/View.svelte'
Expand Down Expand Up @@ -122,7 +122,7 @@
* and updating with JS Date objects
*/
$: {
if (config.isRangePicker) {
if (config.isRangePicker && selected) {
if (selected[0] instanceof Date) {
selectedStartDate.set(dayjs(selected[0]))
}
Expand Down

0 comments on commit c7bb577

Please sign in to comment.