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-headless-dp

v0.6.1

Published

Vue Headless Date Picker is a no ui date picker for vuejs 3

Downloads

35

Readme

Vue Headless Date Picker

Vue Headless Date Picker is a flexible and customizable date picker composable for Vue 3 that allows you to easily add date selection functionality to your Vue.js applications.

Features

  • Supports single-date, multi-date, and range-date selection modes.
  • Equal-weeks option for consistent week display.
  • Date range limiting with minDate and maxDate options.
  • Easily disable specific dates.
  • No UI, giving you complete control over the user interface.

Installation

To get started, install the vue-headless-date-picker package from npm:

npm install @hamedfaryabi/vue-headless-date-picker
# or
yarn add @hamedfaryabi/vue-headless-date-picker

Usage

import { useHeadlessDatePicker } from "@hamedfaryabi/vue-headless-date-picker";

// Import a `@date-io` adapter, in this case, DateFnsAdapter
import DateFnsAdapter from "@date-io/date-fns";

// Create a new instance of the DateFnsAdapter
const adapter = new DateFnsAdapter();

const dp = useHeadlessDatePicker(adapter, {
  selectType: "single",
  equalWeeks: false,
  minDate: new Date(),
});

dp.selected.value = new Date(2022-01-12);
console.log(dp.currentYear.value); // 2022

Documentation

useHeadlessDatePicker(adapter, options)

This function initializes the Vue Headless Datepicker and returns an object containing various properties and methods to manage the date picker's state and behavior.

Parameters:

  • adapter (required): An instance of a date adapter that implements @date-io adapters. This adapter is used for date-related operations.
  • options (optional): An object containing configuration options for the date picker. See Options for available options.

Returns:

An object with the following properties and methods:

| Property/Method | Description | Type | |-------------------------------------|--------------------------------------------------------------------------------------|-----------------------------| | state | An object that holds the internal state of the date picker, including selected dates, current month, and more. | Object | | getMonthOfDate(date: Date) | A function that takes a Date object and returns a DPMonth object representing the month containing the provided date. | Function | | isDateSelected(date: Date) | A function that checks if a given date is selected according to the date picker's selection mode. | Function | | isDateDisabled(date: Date) | A function that checks if a given date is disabled based on the provided disabled dates. | Function | | currentMonth | A computed property that gets or sets the current month of the date picker. It returns a DPMonth object. | Computed Property | | currentYear | A computed property that gets or sets the current year of the date picker. | Computed Property | | selected | A computed property that gets or sets the selected date(s) based on the date picker's selection mode. | Computed Property | | disabled | A computed property that gets or sets the disabled date(s). | Computed Property | | minDate | A computed property that gets or sets the minimum selectable date. | Computed Property | | maxDate | A computed property that gets or sets the maximum selectable date. | Computed Property |

Note: All computed properties have getters and setters. for example:

    datePicker.minDate.value = new Date(); // set the min date
    const min = datePicker.minDate; // returns the min date

Options

Basic configuration options for the date picker

| Property | Description | Type | |--------------------|--------------------------------------------------------------------------------------------------------------|-----------| | initialMonth | Value to initialize the month of the date picker. If not provided, displays the current month. | number | | initialYear | Value to initialize the year of the date picker. If not provided, displays the current year. | number | | equalWeeks | If true, returns days of the previous month in the first week and days of the next month in the last week. | boolean | | selectType | Defines the selection type for the date picker (single, multiple, or range). | string | | disabled | An array of disabled dates. | Date[] | | minDate | The minimum valid date of the date picker. | Date | | maxDate | The maximum valid date of the date picker. | Date |

License

This project is licensed under the MIT License - see the LICENSE file for details.