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

@apility/vue-datepicker

v2.2.0

Published

## Installation

Downloads

168

Readme

Datepicker for Vue 3

Installation

NPM

npm install @apility/vue-datepicker

Yarn

yarn add @apility/vue-datepicker

Usage

You can either register the component globally or locally.

import { DatePicker } from '@apility/vue-datepicker';
Vue.component('date-picker', DatePicker);
<date-picker v-model="date" />

Or you can import it locally in your component.

<script setup>
    import { ref } from 'vue';
    import { DatePicker } from '@apility/vue-datepicker';

    const date = ref(new Date());
</script>

<template>
    <DatePicker v-model="date" />
</template>

Props

| Name | Type | Default | Description | | --- | --- | --- | --- | | v-model | Date | null | The currently selected date. | | min | Date | null | The minimum date that can be selected. | | max | Date | null | The maximum date that can be selected. | | predicate | Function | (date) => true | Determine if a given date should be selectable | | options | Object | {} | Options for the DatePicker. |

The predicate property is a function that receives a Date object and returns a boolean. If the function returns true, the date will be selectable. If the function returns false, the date will be disabled.

This can be used to disable dates that are not available, for example, if you are booking a hotel room.

Options

| Name | Type | Default | Description | | --- | --- | --- | --- | | emitOnMonthChange | Boolean | false | Sets the v-model value to the end or start of the month when changing month in the month view. | | emitOnYearChange | Boolean | false | Sets the v-model value to the end or start of the year when changing year in the year view. | | emitOnDecadeChange | Boolean | false | Sets the v-model value to the end or start of the decade when changing decade in the decade view. |

Localization

This datepicker is built with date-fns. To override the locale and other date-fns options, you must provide a date-fns-options injection.

This package provides a composable to make it easier to provide the localization options.

import { useDateFnsOptions } from '@apility/vue-datepicker';
import { nb } from 'date-fns/locale';

const { setLocale } = useDateFnsOptions();
setLocale(nb)

You may also provide this manually:

import { nb } from 'date-fns/locale';

provide('date-fns-options', {
    locale: nb,
});

Styling

This datepicker is written to be independent of any CSS framework. It is up to you to style the datepicker to fit your needs. However, we provide a default SCSS stylesheet for Bootstrap 5 for your convenience that you can use to get started.

// If using Webpack
@import "~@apility/vue-datepicker";
// If using Vite
@import "../path/to/node_modules/@apility/vue-datepicker";

Make sure to import this stylesheet after Bootstrap, otherwise it won't be able to inherit the Bootstrap styles.