svelte-touch-datepicker

A simple date picker (Wheel and touch) (no dependencies 🔥)

Github星跟踪图

Native like date-picker for Svelte (With wheel control for desktop)

🚀See it in Action

Installation

npm i -D svelte-touch-datepicker

Usage

<script>
  import DatePicker  from "svelte-touch-datepicker";

  let date = new Date();
  $: _date = date.toLocaleDateString("en-US");

</script>

<style>

  .container{
    height: 100%;
    width: 100%;
  }

  .center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font: 20px 'Roboto', sans-serif;
  }
</style>

<div class="container" >
  <div class="center">
    <p>Date: {_date}</p>
    <DatePicker bind:date />
  </div>
</div>

Custom events

<script>
  function callback(event) {
    // you will find the `date` object in event.detail
  }
</script>

<DatePicker
  on:dateChange={callback}
  on:confirmDate={callback2}
/>


Default css custom properties


  :root{
    --svtd-popup-bg-color: white;
    --svtd-popup-color: black;
    --svtd-popup-radius: 10px;
    --svtd-font-size: 20px;
    --svtd-button-color: black;
    --svtd-button-bg-color: transparent;
    --svtd-border: 1px solid grey;
    --svtd-button-box-shadow: none;
    --svtd-bar-color: grey;
  }

Props

Name Type Description Required Default
date object default date object yes new Date()
visible Boolean Popup visibility No false
years_map Array Years map [from, to] No [1900, 2100]
classes String custom classes to be add on input No empty string

主要指标

概览
名称与所有者SharifClick/svelte-touch-datepicker
主编程语言Svelte
编程语言JavaScript (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2019-10-23 14:42:15
推送于2022-12-04 17:25:33
最后一次提交2021-04-06 22:52:16
发布数7
最新版本名称v1.4.1 (发布于 )
第一版名称v1.0.0beta (发布于 )
用户参与
星数38
关注者数3
派生数5
提交数160
已启用问题?
问题数4
打开的问题数1
拉请求数5
打开的拉请求数6
关闭的拉请求数1
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?