2.0.2 • Published 8 months ago

zvelte-datepicker v2.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

zvelte-datepicker

A datepicker fork from the version 2.0.4 of https://github.com/6eDesign/svelte-calendar with time selection fonctionality

Installation

npm i -D zvelte-datepicker

Basic usage

<script>
  import Datepicker from 'zvelte-datepicker';
</script>

<Datepicker start={minDate} end={maxDate} />

Props

prop nametypedefault
startdateone year in past
enddateone year in future
selecteddatetoday
formattedSelectedstringtoday
dateChosenbooleanfalse
withTimebooleanfalse
selectableCallbackfunctionnull
formatstring | function'#{m}/#{d}/#{Y}'
localestringEn-US Locale (see below)
stylestring""

start and end

These properties set the minimum and maximum dates that will be rendered by this calendar. It is recommended that you do not leave these as their defaults and supply values which suit your application's needs.

selected and formattedSelected

Bind to these properties to observe the selected date as either a date or a string. Use selected to set the day which is selected by default.

dateChosen

Bind to this property to observe whether a user has selected a day.

withTime

Boolean to enable time selection

selectableCallback

Provide a function which accepts a date and returns a boolean determining whether a day between start and end is selectable. For example, use this to prevent weekend days from being selected.

format

Date formatting uses timeUtils formatting (MM/DD/YYYY by default). If you would like to use a different formatting library, supply a function which accepts a date and returns a string.

locale

This prop is used to internationalize the calendar.

<Datepicker bind:formattedSelected={selectedDateFormatted} bind:selected={selectedDate} bind:dateChosen={userHasChosenDate} start={threeDaysInPast} end={inThirtyDays} selectableCallback={filterWeekends} withTime={true} locale='fr' format={date => dayjs(date).format('DD/MM/YYYY')} />

## Developing/Modifying Svelte-Calendar Guide

*Note that you will need to have [Node.js] installed.*

Install the dependencies...

```bash
cd zvelte-datepicker
npm install

...then start Rollup:

npm run dev

Navigate to localhost:3000. You should see your app running. Edit a component file in src, save it, and your browser will reload the page so you can see your changes automatically.

2.0.2

8 months ago

2.0.1

8 months ago

2.0.0

8 months ago

0.1.0

1 year ago

0.0.5

1 year ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago