npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue3-datepicker

v0.4.0

Published

A simple Vue 3 datepicker component. Supports disabling of dates, translations. Dependent on date-fns.

Downloads

104,899

Readme

Vue 3 Datepicker

Documentation: https://icehaunter.github.io/vue3-datepicker/

This is a basic (at least for now) reimplementation of https://github.com/icehaunter/vuejs-datepicker in Vue 3 and with greatly cleaned up code.

All date manipulation and formatting are done via the amazing date-fns library, so it's a direct dependency of this picker.

Installation

Package is available on NPM: https://www.npmjs.com/package/vue3-datepicker

npm i vue3-datepicker

The component is packaged mainly for use with bundlers, if you require a browser build - post an issue.

Usage

For more examples see https://icehaunter.github.io/vue3-datepicker/examples.html

<template>
  <datepicker
    v-model="selected"
    :locale="locale"
    :upperLimit="to"
    :lowerLimit="from"
    :clearable="true"
  />
</template>

Props and attributes

Attribute fallthrough is enabled, so any attribute you apply to the component will be passed down to the input.

All props which accept formatting strings for dates use date-fns formatting function under the hood, so see that function's documentation for patterns.

Main interaction to date selection is done via v-model with Date as expected type of the value passed.

Full props documentation is available at https://icehaunter.github.io/vue3-datepicker/config.html#props

| ID | Type | Default | Description | | ------------------------ | -------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | upperLimit | Date | | Upper limit for available dates for picking | | lowerLimit | Date | | Lower limit for available dates for picking | | startingViewDate | Date | () => new Date() | Date on which to focus when empty datepicker is opened. Default is "right now" | | disabledDates | { dates: Date[] } | | Dates not available for picking | | disabledTime | { dates: Date[] } | | Dates not available for time picking | | startingView | 'time' \| 'day' \| 'month' \| 'year' | 'day' | View on which the date picker should open. Can be either year, month, or day | | minimumView | 'time' \| 'day' \| 'month' \| 'year' | 'day' | If set, lower-level views won't show | | dayPickerHeadingFormat | String | LLLL yyyy | date-fns-type formatting for a day view heading | | dayFormat | String | dd | date-fns-type formatting for each day on the day view | | weekdayFormat | String | EE | date-fns-type formatting for a line of weekdays on day view | | inputFormat | String | yyyy-MM-dd | date-fns-type format in which the string in the input should be both parsed and displayed | | locale | Locale | date-fns/locale/en | date-fns locale object. Used in string formatting (see default dayPickerHeadingFormat) | | disabled | Boolean | false | Disables datepicker and prevents it's opening | | typeable | Boolean | false | Allows user to input date manually | | weekStartsOn | Number | 1 | Day on which the week should start. Number from 0 to 6, where 0 is Sunday and 6 is Saturday. Week starts with a Monday (1) by default | | clearable | Boolean | false | Allows clearing the selected date and setting the value to null | | allowOutsideInterval | Boolean | false | Allows user to click dates outside of current interval |

Events

  • opened: Emitted every time the popup opens, including on field focus
  • closed: Emitted every time the popup closes, including on field blur
  • decadePageChanged: Emitted when a page is changed on the year picker view, displaying a different decade. Has a date that is included in the shown decade as an argument.
  • yearPageChanged: Emitted when a page is changed on the month picker view, displaying a different year. Has a date that is included in the shown year as an argument.
  • monthPageChanged: Emitted when a page is changed on the day picker view, displaying a different month. Has a date that is included in the shown month as an argument.

Compatibility

Package is transpiled and should be usable for everyone with ES6 and above, but the styling of the datepicker itself uses CSS Grid and CSS variables.

Example

<template>
  <datepicker v-model="picked" />
</template>

<script>
import Datepicker from '../src/datepicker/Datepicker.vue'
components: {
  Datepicker
},
data(): {
  return {
    picked: new Date();
  }
}
</script>