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

simple-vue-datepicker

v0.0.14

Published

A simple Vue.js datepicker component. Supports disabling of dates, translations

Downloads

42

Readme

Datepicker

simple-vue-datepicker

Implement a very simple calendar-based datepicker

Derived and stripped down from https://github.com/charliekassel/vuejs-datepicker

A datepicker Vue component. Compatible with Vue 2.x

N.B. - this is in a very raw intermediate state and is not meant for general public consumption at this point. I'm working on another project and will be cleaning this up over time but for now:

  1. it's not tested except for my specific use cases
  2. the documentation is inaccurate - it has not been scrubbed
  3. it's only partially stripped down - there are lots of relics

Install

$ npm install simple-vue-datepicker --save
import Datepicker from 'simple-vue-datepicker';

Vue.component('my-component', {
    components: {
        Datepicker
    }
});

Usage

<datepicker></datepicker>

value prop sets the selectedDate. should be a Date object. defaults to null - no date selected.

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

Use v-model for two-way binding

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

Emits events

Some of these might still work

<datepicker v-on:selected="doSomethingInParentComponentFunction" v-on:opened="datepickerOpenedFunction" v-on:closed="datepickerClosedFunction">

Inline always open version

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

Available props

| Prop | Type | Default | Description | |-----------------------|--------------|-------------|------------------------------------------| | value | Date/String | | Date value of the datepicker | | language | String | en | Translation for days and months | | disabled | Object | | See below for configuration | | inline | Boolean | | To show the datepicker always open | | initialViewDate | Date/String | value | Year/month to initially show on calendar | | mondayFirst | Boolean | false | Show Monday as first day of week |

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 | | cleared | | Selected date has been cleared|

Disabled Dates

Dates can disabled in a number of ways.

<script>
var state = {
    disabled: {
        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
        days: [6, 0], // Disable Saturday's and Sunday's
        dates: [ // Disable an array of dates
            new Date(2016, 9, 16),
            new Date(2016, 9, 17),
            new Date(2016, 9, 18)
        ]
    }
}
</script>
<datepicker :disabled="state.disabled"></datepicker>

Highlight Dates

Dates can be highlighted (e.g. for marking an appointment) in a number of ways. Important: You can only highlight dates that aren't disabled. Note: Both to and from properties are required to define a range of dates to highlight

<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
        days: [6, 0], // Highlight Saturday's and Sunday's
        dates: [ // Highlight an array of dates
            new Date(2016, 9, 16),
            new Date(2016, 9, 17),
            new Date(2016, 9, 18)
        ]
    }
}
</script>
<datepicker :highlighted="state.highlighted"></datepicker>

Translations

Contributing guide - please use appropriate code from this list as the translation property.

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

Available languages

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