All Projects → shubhadip → vuejs3-datepicker

shubhadip / vuejs3-datepicker

Licence: MIT License
vue 3 datepicker. supports disabling, highlighting of dates and programmatic access of date.

Programming Languages

HTML
75241 projects
Vue
7211 projects
javascript
184084 projects - #8 most used programming language
typescript
32286 projects
CSS
56736 projects

Projects that are alternatives of or similar to vuejs3-datepicker

Datepicker
Get a date with JavaScript! A datepicker with no dependencies.
Stars: ✭ 212 (+821.74%)
Mutual labels:  date, calendar, datepicker, date-picker
Calendarview
An Easy to Use Calendar for iOS (Swift 5.0)
Stars: ✭ 429 (+1765.22%)
Mutual labels:  date, calendar, datepicker, date-picker
React Date Picker
A date picker for your React app.
Stars: ✭ 715 (+3008.7%)
Mutual labels:  date, calendar, date-picker
React Nice Dates
A responsive, touch-friendly, and modular date picker library for React.
Stars: ✭ 924 (+3917.39%)
Mutual labels:  date, datepicker, date-picker
React Datetimerange Picker
A datetime range picker for your React app.
Stars: ✭ 82 (+256.52%)
Mutual labels:  date, calendar, date-picker
React Infinite Calendar
✨ Infinite scrolling date-picker built with React, with localization, range selection, themes, keyboard support, and more.
Stars: ✭ 3,828 (+16543.48%)
Mutual labels:  date, calendar, datepicker
Angular Moment Picker
Angular Moment Picker is an AngularJS directive for date and time picker using Moment.js.
Stars: ✭ 536 (+2230.43%)
Mutual labels:  date, calendar, datepicker
Laydate
layDate(日期与时间组件) 是 layui 独立维护的三大组件之一
Stars: ✭ 1,066 (+4534.78%)
Mutual labels:  date, calendar, datepicker
vue-single-date-picker
A Vue project - single date picker
Stars: ✭ 16 (-30.43%)
Mutual labels:  date, datepicker, date-picker
Things Calendar
Simple but elegant datepicker for the web — inspired by Things for mac
Stars: ✭ 165 (+617.39%)
Mutual labels:  date, calendar, datepicker
React Calendar
Ultimate calendar for your React app.
Stars: ✭ 2,082 (+8952.17%)
Mutual labels:  date, calendar, date-picker
Dpicker
A framework-agnostic minimal date picker
Stars: ✭ 187 (+713.04%)
Mutual labels:  date, calendar, date-picker
Zebra datepicker
A super-lightweight, highly configurable, cross-browser date / time picker jQuery plugin
Stars: ✭ 367 (+1495.65%)
Mutual labels:  date, calendar, datepicker
Vue Ctk Date Time Picker
VueJS component to select dates & time, including a range mode
Stars: ✭ 707 (+2973.91%)
Mutual labels:  date, calendar, datepicker
React Datetime Picker
A datetime picker for your React app.
Stars: ✭ 294 (+1178.26%)
Mutual labels:  date, calendar, date-picker
Rsdayflow
iOS 7+ Calendar (Date Picker) with Infinite Scrolling.
Stars: ✭ 843 (+3565.22%)
Mutual labels:  date, calendar, datepicker
Calendar
📆 calendar 日历
Stars: ✭ 119 (+417.39%)
Mutual labels:  date, calendar, datepicker
Vuejs Datepicker
A simple Vue.js datepicker component. Supports disabling of dates, inline mode, translations
Stars: ✭ 2,529 (+10895.65%)
Mutual labels:  date, datepicker, date-picker
Calendarview
A highly customizable calendar library for Android, powered by RecyclerView.
Stars: ✭ 2,862 (+12343.48%)
Mutual labels:  date, calendar, datepicker
silverware-calendar
SilverWare Calendar Module
Stars: ✭ 15 (-34.78%)
Mutual labels:  date, datepicker

Vue 3 Datepicker

Netlify Status

A datepicker Vue component. Compatible with Vue 3 Only

To view demo examples locally clone the repo and run npm install && npm run dev

Demo

To view a demo online: https://vuejs3-datepicker.netlify.app/

Install

npm install vuejs3-datepicker --save

yarn add vuejs3-datepicker
import Datepicker from 'vuejs3-datepicker';

export default {
  // ...
  components: {
    Datepicker
  }
  // ...
}

Usage

<datepicker></datepicker>

value prop if passed should be a Date object

<script>
var state = {
  date: new Date(2016, 9,  16)
}
</script>
<datepicker :value="state.date"></datepicker>

support name attribute for normal html form submission

<datepicker :value="state.date" name="uniquename"></datepicker>

Using v-model

<datepicker v-model="state.date" name="uniquename"></datepicker>

Emits events

<datepicker @selected="parentfunctionSelectedhandler" @opened="datepickerOpenedFunction" @closed="parentfunctionCloseHandler">

Inline always open version

<datepicker :inline="true"></datepicker>

Programtic Acess of value of datepicker

<datepicker ref="inputRef"  @selected="handleSelectDate" :disabled-dates="disabledDates" :highlighted="highlightDates" :value="date" @closed="handleCalendarClose" ></datepicker>
const { selectedDate } = (inputRef.value  as any).value; 

icon color, icon height, icon width of calendar

<datepicker :icon-color="color" :icon-width="width" :icon-height="height" ></datepicker>

Available props

Prop Type Default Description
modelValue Date|String Date value of the datepicker via v-model
value Date|String Date value of the datepicker
format String|Function dd MMM yyyy Date formatting string or function
full-month-name Boolean false To show the full month name
disabled-dates Object See below for configuration
placeholder String Input placeholder text
inline Boolean To show the datepicker always open
calendar-class String|Object CSS class applied to the calendar el
input-class String|Object CSS class applied to the input el
wrapper-class String|Object CSS class applied to the outer div
monday-first Boolean false To start the week on Monday
clear-button Boolean false Show an icon for clearing the date
clear-button-icon String Use icon for button (ex: fa fa-times)
calendar-button Boolean false Show an icon that that can be clicked
calendar-button-icon String Use icon for button (ex: fa fa-calendar)
calendar-button-icon-content String Use for material-icons (ex: event)
day-cell-content Function Use to render custom content in day cell
initial-view String minimumView If set, open on that view
disabled Boolean false If true, disable Datepicker on screen
typeable Boolean false If true, allow the user to type the date
use-utc Boolean false use UTC for time calculations
open-date Date|String If set, open on that date
minimum-view String 'day' If set, lower-level views won't show
maximum-view String 'year' If set, higher-level views won't show
preventDisableDateSelection Boolean true will prevent selection of disabled date
iconColor String black will change calendar icon color
iconWidth String Number 16
iconHeight String Number 16

Events

These events are emitted on actions in the datepicker

Event Output Description
opened The picker is opened
closed The picker is closed
selected Date|null A date has been selected
input Date|null Input value has been modified
cleared Selected date has been cleared
changed-month Object Month page has been changed
changed-year Object Year page has been changed
changed-decade Object Decade page has been changed

Disabled Dates

Dates can be disabled in a number of ways.

<script>
var state = {
  disabledDates: {
    to: new Date(2016, 0, 5), // Disable all dates up to specific date
    from: new Date(2016, 0, 26), // Disable all dates after specific date
    
    dates: [ // Disable an array of dates
      new Date(2016, 9, 16),
      new Date(2016, 9, 17),
      new Date(2016, 9, 18)
    ],
    preventDisableDateSelection: true
  }
}
</script>

<datepicker :disabled-dates="state.disabledDates" :prevent-disable-date-selection="preventDisableDateSelection"></datepicker>

Highlighted Dates

<script>
var state = {
  highlighted: {
    to: new Date(2016, 0, 5), // Highlight all dates up to specific date
    from: new Date(2016, 0, 26), // Highlight all dates after specific date
    dates: [ // Highlight an array of dates
      new Date(2016, 9, 16),
      new Date(2016, 9, 17),
      new Date(2016, 9, 18)
    ]
    },
    includeDisabled: true // Highlight disabled dates
  }
}
</script>
<datepicker :highlighted="state.highlighted"></datepicker>

Add new Locale

new Locale can be added to the following file /src/components/datepicker/locale/index.ts

create a function with new Locale name & export that from data object at the bottom 

e.g

const newLocale = (): any => {
  const langName = 'Hindi';
  const monthFullName = [
    'जनवरी',
    'फ़रवरी',
    'मार्च',
    'अप्रैल',
    'मई',
    'जून',
    'जुलाई',
    'अगस्त',
    'सितंबर',
    'अक्टूबर',
    'नवंबर',
    'दिसंबर',
  ];
  const shortName = ['जन', 'फ़र', 'मार्च', 'अप्रै', 'मई', 'जून', 'जुला', 'अगस्त', 'सितं', 'अक्टू', 'नवं', 'दिसं'];
  const days = ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरु', 'शुक्र', 'शनि'];
  const daysNames = ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरुवार', 'शुक्रवार', 'शनिवार'];
  const rtl = false;
  const ymd = false;
  const yearSuffix = '';
  return {
    months: monthFullName,
    monthsAbbr: shortName,
    days,
    language: langName,
    yearSuffix,
    ymd,
    rtl,
    langName,
    daysNames,
  };
};

export const data = {
  af: af(),
  hi: hi(),
  de: de(),
  en: en(),
  fr: fr(),
  nl: nl()
  ...
  newLocale: newLocale()
};

Contributors:

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].