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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vuejs-range-datepickers

v2.0.0

Published

Component utilizing VueJS-Datepicker for a Data Range Select for VueJs

Downloads

62

Readme

vuejs-range-datepickers

Component utilizing VueJS-Datepicker for a Data Range Select for VueJs.

Installation


###npm

npm install --save vuejs-range-datepickers

Usage


//   app.js
window.Vue = require('vue');

Vue.component('range-datepickers',require('vuejs-range-datepickers'));

const app = new Vue({
  el: '#app'
})

value prop if passed should be a Date object or valid date string

//   index.html
<!doctype html>
  <html>
    <head>
      <meta charset="utf-8"/>
    </head>
    <body>
      <div id="app">
        <range-datepickers start-date="06-10-2017" end-date="06-20-2017"></range-datepickers>
      </div>
      <script src="main.js"></script>
    </body>
  </html>

more uses cases

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

support name attribute for normal html form submission

<range-datepickers :value="state.date" name="uniquename"></range-datepickers>

Use v-model for two-way binding

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

Inline always open version

<range-datepickers :inline="true"></range-datepickers>

Available props

| Prop | Type | Default | Description | |-----------------------|--------------|-------------|------------------------------------------| | value | Date/String | | Date value of the datepicker | | name | String | | Input name property | | id | String | | Input id | | format | String | dd MMM yyyy | Date formatting string | | language | String | en | Translation for days and months | | disabled | Object | | See below for configuration | | placeholder | String | | Input placeholder text | | inline | Boolean | | To show the datepicker always open | | input-class | String | | CSS class applied to the input el | | wrapper-class | String | | 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) | | bootstrapStyling | Boolean | false | Output bootstrap styling classes | | initial-view | String | 'day' | If 'month' or 'year', open on that view | | disabled-picker | Boolean | false | If true, disable Datepicker on screen | | required | Boolean | false | Sets html required attribute on input | | bootstrap-row | Boolean | true | Sets html styles for .row with even cols | | restrict-dates | Boolean | true | Restrict the end date to be past start | | start-label | String | "FROM:" | Adjust/remove a label for the start input| | end-label | String | "TO:" | Adjust/remove a label for the end input | | submit-callback | Function | null | Set a callback to handle button event | | submit-text | String | "UpDate" | Sets submit button text | | disabled-dates | Array | [] | Array of Dates|date strings | | no-overlap | Boolean | true | Forces End Date to change if overlapping after start date changed| | minimum-duration | Number | 1 | Sets end date to start + minimum-duration if overlap occurs|

Available data attributes

This data is used to restrict both calendars for a date range and specific dates that may change use the recommended disabled-dates property if your data will not change

defaultDisabledDates: {
    to: new Date('1990-12-31'),
    from: new Date('3333-12-31'),
    dates: []
},

slots

  • header-title
  • header-legend
  • button

Date formatting

NB. This is not very robust at all - use at your own risk! Needs a better implementation.

| Token | Desc | Example | |-------|------------------------|-------------| | d | day | 1 | | dd | 0 prefixed day | 01 | | D | abbr day | Mon | | su | date suffix | st, nd, rd | | M | month number (1 based) | 1 (for Jan) | | MM | 0 prefixed month | 01 | | MMM | abbreviated month name | Jan | | MMMM | month name | January | | yy | two digit year | 16 | | yyyy | four digit year | 2016 |

Translations

<datepicker language="es"></datepicker>

Available languages

| Abbr | Language | | | ----------- |------------------|----------| | en | English | Default| | bs | Bosnian | | | es | Spanish | | | fi | Finnish | | | fr | French | | | hu | Hungarian | | | hr | Croatian | | | id | Indonesian | | | it | Italian | | | nl | Dutch | | | de | German | | | da | Danish | | | nb-no | Norwegian Bokmål | | | cs | Czech | | | pt-br | Portuguese-Brazil| | | ro | Romanian | | | vi | Vietnamese | | | zh | Chinese | | | ja | Japanese | | | he | Hebrew | | | ru | Russian | | | sk | Slovak | | | sl-si | Slovenian | | | sv | Swedish | | | th | Thai | | | bg | Bulgarian | | | lt | Lithuanian | | | pl | Polish | | | ar | Arabic | | | ee | Estonian | | | ko | Korean | | | tr | Turkish | | | uk | Ukrainian | | | is | Icelandic | |

Live Example


I have created an example vue webapp (documentation here), demonstrating this range date selector via simple vue app.

TODOs


  • allow minimum-duration to be and array of dates with a duration
  • get more feedback!

Contributions


All contributions are welcome: use-cases, documentation, code, patches, bug reports, feature requests, etc. You do not need to be a programmer to speak up!

version changes

v1.0.0

  • start date is no longer restricted by end date.
  • can disable an array of dates :disable-dates
  • defaults to not allow overlapping disabled dates :no-overlap
  • defaults to :end-plus="1" which adds this value to end date if the overlapping forces the end-date to change
  • :default-disabled-dates is the datepicker 'disabled' option for both of the range pickers. this allows for setting max (from), min (to), and dates (disabled individual dates) that can be modified by parent components

v1.2.0

  • removed end-plus , changed to minimum-duration
  • other date restrictions based on minimum-duration and disabled-dates...