Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
Month.svelte
range.js
<script>
import { differenceInDays, isSameDay } from 'date-fns'
import Month from './Month.svelte'
import {rangeText} from './range.js'
const monthNames = [
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
]
let year = 2021
let selection = {}
function select({detail: date}) {
if (!selection.start && !selection.end) {
selection.start = date
selection.end = date
return
}
if (isSameDay(selection.start, date) && isSameDay(selection.end, date)) {
selection = {}
}
if (isSameDay(selection.start, date)) {
selection.start = selection.end
return
}
if (isSameDay(selection.end, date)) {
selection.end = selection.start
return
}
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */