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

vue-date-range-select

v1.0.4

Published

Date range input for Vue created with Typescript

Downloads

3

Readme

Date range component interaction

Vue date range select

A Vue date range select component for updating Javascript Date objects. Provides great user feedback, easy customization by overwriting the styles. (When to show / hide the calendar is up to you)

Created with Typescript, Vue and uses Rollup to build the npm package.

Installation

npm install vue-date-range-select

Usage

  1. Import component
import VueDateRangeSelect from 'vue-date-range-select';
  1. Import styles, or write your own styles (scroll to bottom to copy the initial styling)
import 'vue-date-range-select/dist/styles.css';
  1. Add component to your template
<template>
  <!-- ... -->
  <vue-date-range-select v-model="dateRange">
  <!-- ... -->
</template>

<script>
export default {
  // ...
  components: {
    VueDateRangeSelect
  },
  data() {
    return {
      dateRange: { endDate: null, startDate: null },
    }
  },
  // ...
}
</script>

Available props

| Prop | Type | Default | Description | |------------------|----------------------------------------------------|-------------------------------------|----------------------------------| | value | { startDate: null | Date, endDate: null | Date } | { startDate: null, endDate: null } | Date values of date picker | | monthCount | number | 2 | Amount of months shown in select | | locale | string | en-EN | Used for setting language of months and days MDN| | hideYear | boolean | false | Stop showing year next to month | | canSelectInPast | boolean | false | Disables the user to select days in the past | | startOnSunday | boolean | false | Show Sundays first |

Component functions

Functions inside the vue date range component to mutate the state from outside

<template>
  <!-- ... -->
  <vue-date-range-select ref="dateRange" v-model="{ endDate: null, startDate: null }"/>

  <!-- Clear both startDate and endDate -->
  <button @click="$refs.dateRange.clear()">Clear</button>

  <!-- Force selecting endDate first  -->
  <button @click="$refs.dateRange.isSelectingStartDate = false">Select endDate</button>

  <!-- Force selecting startDate first  -->
  <button @click="$refs.dateRange.isSelectingStartDate = true">Select startDate</button>
  <!-- ... -->
</template>

Slots

Add fields to the top of the date range select, or to the bottom

<template>
  <!-- ... -->
  <vue-date-range-select v-model="{ endDate: null, startDate: null }">
    <template #header>Content added to the top of the calendar</template>
    <template #footer>Content added to the bottom of the calendar</template>
  </vue-date-range-select>
  <!-- ... -->
</template>

Code example

Advanced example with slots, date preview using Typescript

Running / seeing the advanced example?

  1. Clone the project
  2. npm install
  3. npm run serve

Contributions

Contributions would be very much appreciated! Please add some tests as well 🧪

Hope you like it