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

@pderas/vue2-date-selector

v2.0.4

Published

A vue 2 component for selecting dates

Downloads

31

Readme

Vue Date Selector

A collection of vue 2 components for selecting a date. <date-selector> provides 3 input boxes for an easy way to select the day, month, and year. <calendar-picker> displays a calendar to select an individual date, or a start and end date.

How to initialize Vue Date Selector

Vue date selector is built as a vue plugin. It can be initialized just as the Vue documentation states.

import DateSelector from "@pderas/vue2-date-selector";

// this provides access to both <date-selector /> and <calendar-picker /> components globally
Vue.use(DateSelector);

Usage

<date-selector /> Creation

Vue date selector is easily created, and has many properties that can be changed.

<date-selector></date-selector>

<date-selector /> Properties

| Property | Required | Type | Default | Description | |---------------|:--------:|------------------|----------------------------|-------------------------------------------------------------------------| | value | false | String|Date | Date() | Value for the input, can be used with v-model | | formatFn | false | Function | (value) => {return value } | Formats the labels based on the function provided | | amountOfYears | false | Number | 20 | The amount of years to show in the date selector, from the current year | | amountOfYearsAfter | false | Number | 0 | The amount of years to show in the date selector, from after the current year | | disabled | false | Object | null | Specifies dates to disable from being selected in the picker | | disabledInput | false | Boolean | false | Disables the inputs on the date selector |

Disabled Dates

The disabled object contains two potential keys for disabling ranges of dates.

  • to This is used for disabling dates up to a specific date.
  • from This is used for disabled dates after a specific date.

Currently only to or from can be used separately. They cannot be used together. The value can be either a valid date string or a date object.

Styling

Styling is currently limited, but can be expanded in the future.

<calendar-picker /> Creation

Vue calendar picker is easily created, and has many properties that can be changed.

<calendar-picker v-model='dates' />

<calendar-picker /> Properties

| Property | Required | Type | Default | Description | |--|--|--|--|--| | value | true | Object | -- | passed in the form of either { day: null } for single date picking, or { start: null, end: null } for multi day picking | | month | false | Number | new Date().getMonth() + 1 | ones based month to be displayed (Jan = 1, Dec = 12) | | year | false | Number | new Date().getFullYear() | year to be displayed | | multiDaySelect | false | Boolean | True | Allow either single, or multi day selection | | next | false | String | Next | string to be displayed for next month button | | prev | false | String | Prev | string to be displayed for previous month button | | highlighted | false | Object | {} | days that should be highlighted on load. can include tooltip information to be displayed on hover. should be passed in the format { [dd-MM-yyyy]: { name: 'My Tooltip Info' }}. for example:

{
    "28-09-2018": {
        name: "last friday in september"
    },
    "01-10-2018": {
        name: "first monday in october"
    }
}

Misc

Instead of providing a value prop, v-model can be used to make use of two way data binding. Similarly, the month and year props can be bound using the .sync modifier.

<!-- sync example -->
<calendar-picker
    v-model='selectedDates'
    :month.sync='month'
    :year.sync='year' />

Styling

All elements are namespaced starting with .cal and are written at the root level for the easiest customization. The calendar will grow/shrink width in relation to the surrounding div, and the squares height can be easily overwritten using .cal-day { height: 50px; }. The most common styles to be overridden are likely to be the background colors of: .cal-header, .cal-inactive, .cal-today, .cal-highlighted, .cal-clicked, .cal-faded.

calendar-picker component

License

This project is covered under the MIT License. Feel free to use it wherever you like.