All Projects → onx2 → s-date-range-picker

onx2 / s-date-range-picker

Licence: MIT license
📅 A date range picker built with Svelte

Programming Languages

Svelte
593 projects
javascript
184084 projects - #8 most used programming language
SCSS
7915 projects
HTML
75241 projects

Projects that are alternatives of or similar to s-date-range-picker

svelte-meteor-data
Reactively track Meteor data inside Svelte components
Stars: ✭ 14 (+7.69%)
Mutual labels:  svelte, sveltejs, svelte-v3, svelte3, svelte-js
ui-svelte
A component library for Svelte
Stars: ✭ 18 (+38.46%)
Mutual labels:  svelte-components, svelte, sveltejs, svelte-v3, svelte3
Svelte Material Ui
Svelte Material UI Components
Stars: ✭ 2,081 (+15907.69%)
Mutual labels:  svelte-components, svelte, sveltejs, svelte3
svelte-headlessui
Unofficial Svelte port of Headless UI components
Stars: ✭ 564 (+4238.46%)
Mutual labels:  svelte-components, svelte, sveltejs, svelte3
svelte-progressbar
A multiseries, SVG progressbar component made with Svelte
Stars: ✭ 85 (+553.85%)
Mutual labels:  svelte-components, svelte, sveltejs, svelte-v3
hacker-feud
💥 A single page web game made with Svelte.
Stars: ✭ 61 (+369.23%)
Mutual labels:  sveltejs, svelte-v3, svelte3, svelte-js
svelte-interview-questions
Concepts and Questions related to Svelte - Part of official Svelte resources list
Stars: ✭ 18 (+38.46%)
Mutual labels:  svelte, sveltejs, svelte3, svelte-js
svelte-webcomponents
A ready-to-use project template to build custom elements (web components) with Svelte 3 with support and examples for web components, jest, sass, nested components with props, eslinting, stylelinting, Github actions, propagating custom events from shadow-DOM to real-DOM etc.
Stars: ✭ 22 (+69.23%)
Mutual labels:  svelte, sveltejs, svelte3
svelte-portal
Svelte component for rendering outside the DOM of parent component
Stars: ✭ 261 (+1907.69%)
Mutual labels:  svelte, sveltejs, svelte3
BeatHub
Small, simple, and fast custom beatmap browser & downloader built with Svelte
Stars: ✭ 13 (+0%)
Mutual labels:  svelte, svelte-v3, svelte3
svelte-material
Modular and customizable Material Design UI components for Svelte.js
Stars: ✭ 30 (+130.77%)
Mutual labels:  svelte-components, svelte, sveltejs
focus-svelte
focus lock for svelte
Stars: ✭ 18 (+38.46%)
Mutual labels:  svelte-components, svelte, sveltejs
svelte-color-picker
A color picker component for svelte
Stars: ✭ 96 (+638.46%)
Mutual labels:  svelte, sveltejs, svelte-v3
svelte-typescript-rollup
Svelte + Typescript + Rollup
Stars: ✭ 79 (+507.69%)
Mutual labels:  svelte, sveltejs, svelte-js
plate-app
🍛 What's on your Plate?
Stars: ✭ 49 (+276.92%)
Mutual labels:  svelte, sveltejs, svelte-v3
memento-svelte-electron-typescript
Template to create a desktop app with Svelte, TailwindCSS, Electron and TypeScript (with electron-updater, electron-reload and electron-builder)
Stars: ✭ 27 (+107.69%)
Mutual labels:  svelte, sveltejs, svelte-js
svelty-picker
Simple date & time picker in svelte
Stars: ✭ 38 (+192.31%)
Mutual labels:  svelte, datepicker, datetimepicker
svelte-starter-kit
Svelte with brilliant bells and useful whistles
Stars: ✭ 384 (+2853.85%)
Mutual labels:  svelte, sveltejs, svelte3
svelte-inview
A Svelte action that monitors an element enters or leaves the viewport.🔥
Stars: ✭ 358 (+2653.85%)
Mutual labels:  svelte, svelte3, svelte-js
fa-svelte
Font Awesome 5 for svelte.js
Stars: ✭ 72 (+453.85%)
Mutual labels:  svelte-components, svelte, sveltejs

s-date-range-picker (alpha)

⚠️ This repository isn't maintained anymore but feel free to fork it as a good starting place for a date picker in svelte.

CircleCI npm version

Branch coverage Function coverage Line coverage Statement coverage

A date range picker built with Svelte

Getting Started

In a Svelte App

  • npm: npm i s-date-range-picker
  • yarn: yarn add s-date-range-picker
<script>
  import SDateRangePicker from "s-date-range-picker";

  // Manage start and end props from main app component
  let startDate = new Date();
  let endDate = new Date();

  // Update state on apply event
  function onApply({ detail }) {
    startDate = detail.startDate;
    endDate = detail.endDate;
  }
</script>

<SDateRangePicker {startDate} {endDate} on:apply={onApply} />

Development

  • Clone the repo: git clone https://github.com/onx2/s-date-range-picker.git
  • Enter directory: cd svelte-date-range-picker
  • Install dpendencies: yarn
  • Run dev web server: yarn serve
  • Run tests: yarn test
  • Run format: yarn format
  • Run linter: yarn lint
  • Run build: yarn build

API

Props / Options

applyBtnText: string = "Apply";

cancelBtnText: string = "Camcel";

dateFormat: string = "MMM dd, yyyy";

disabledDates: Date[] = [];

endDate: Date = endOfWeek(new Date());

firstDayOfWeek: string = "sunday";

locale?: Locale = undefined; // date-fns defaults to the system locale.

maxDate: Date = addYears(new Date(), 10);

minDate: Date = subYears(new Date(), 10);

monthDropdown: boolean = false;

monthFormat: string = "MMMM";

nextIcon: string | HTMLElement = "&#9656;"; - 

prevIcon: string | HTMLElement = "&#9666;"; // (html | string) - ◂

resetViewBtn: boolean = false;

resetViewBtnText: string | HTMLElement = "&#8602;" // ↚

rtl: boolean = false;

singlePicker: boolean = false;

startDate: Date = startOfWeek(new Date());

timePicker: boolean = false;

timePickerControls: boolean = false;

timePickerIncrement: number = 1;

timePickerSeconds: boolean = false;

today: Date = new Date(); // Used as a reference in predefinedRanges and for underlining in calendar

todayBtn: boolean = false;

todayBtnText: string = "Today";

twoPages: boolean = true;

weekGuides: boolean = false; // Distance in calendar weeks from today

weekNumbers: boolean = false; // Local week numbers

yearDropdown: boolean = false;

Events

// Fired when a selection is made (start or end date has been chosen)
selection(): { startDate: Date, endDate: Date};

// Fired when the "Cancel" button is clicked
cancel(): { startDate: Date, endDate: Date};

// Fired when the "Apply" button is clicked
apply(): { startDate: Date, endDate: Date};

Goals

  • 100% test coverage
  • Event data
  • Better accessibility
  • Total localization
  • AM / PM times
  • Maximum span of days option
  • Predefined ranges option
  • Add storybook for demo site to display different props / options
  • Convert to Typescript
  • Theming capabilities with a default theme

Thanks geakstr for the Svelte component template!

This project is using date-fns under the hood for date calculations / manipulation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].