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-3-material-date-picker

v1.2.0

Published

<div align="center"> <img src="https://github.com/MatijaNovosel/vue-3-material-date-picker/assets/36193643/424ba8ee-5745-4efd-a411-80449424d149" /> </div>

Downloads

747

Readme

🚀 Installation

Install using your package manager of choice:

yarn add vue-3-material-date-picker

✨ Features

  • Multiple date selection
  • Customizable and themable
  • Can be changed to any locale on the fly

📺 Demo

https://matija-components.vercel.app/date-picker

⚙️ Usage

Import the component locally or define it globally and include the css file:

<template>
  <div style="display: flex">
    <date-picker
      multiple
      :selected-items-text-formatter="(n) => `${n} dates selected`"
      :first-day-of-week="1"
      :allowed-dates="(date) => parseInt(date.split('-')[2], 10) % 2 === 0"
      :locale="locale"
      v-model="date"
    />
    <div style="margin-left: 30px">
      {{ date }}
      <button @click="changeDate" style="margin-left: 5px">Change</button>
      <button @click="changeLocale" style="margin-left: 5px">
        Change locale
      </button>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import { DatePicker } from "vue-3-material-date-picker";
import "vue-3-material-date-picker/dist/style.css";

const date = ref(new Date().toISOString().substring(0, 10));
const locale = ref("en-US");

const changeDate = () => {
  date.value = "2023-09-23";
};

const changeLocale = () => {
  locale.value = "hr-HR";
};
</script>

📃 Props

| Name | Type | Default | Description | | ------------------------------- | -------------------------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------- | | v-model | string/string[] | null | Standard two way input, must be passed as an ISO string (YYYY-mm-dd format e.g. 2023-04-23) | | min | string | 1970-01-01 | Allowed starting date, must be passed as an ISO string (YYYY-mm-dd format e.g. 2023-04-23) | | max | string | Current date | Allowed ending date, must be passed as an ISO string (YYYY-mm-dd format e.g. 2023-04-23) | | disabled | boolean | false | Makes the component uninteractable | | readonly | boolean | false | Makes the component uninteractable, but without the style of the disabled variant | | width | number/string | 290px | Sets the width of the element - can be provided as a string like "290px" or "290" or a number, defaults to 290px | | full-width | boolean | false | Ignores the previous width prop and sets the width to 100% of the parent container | | color | string | #2e79bd | Color of the various active component elements | | first-day-of-week | number/string | 0 | Sets the first day of the week, starting with 0 for Sunday | | hide-title | boolean | false | Hide the picker title | | show-adjacent-months | boolean | false | Toggles visibility of days from previous and next months | | locale | string | undefined | Sets the locale, accepts a string with a BCP 47 language tag e.g. en-us or hr-HR | | multiple | boolean | false | Allow the selection of multiple dates | | allowed-dates | function ((date: string) => boolean) | null | Restricts which dates can be selected | | selected-items-text-formatter | function ((n: number) => string) | Selected ${n} dates | Function for formatting the text for selecting multiple dates | | title-text-formatter | function ((date: string) => string) | undefined | Function for formatting the title text | | events | string[] | [] | Marks the provided dates on the component with a small dot |

🎺 Events

| Name | Type | Description | | -------------- | ------------------------ | ------------------------------------------------- | | change | (date: string) => void | Triggered when a date is selected | | select:year | () => void | Triggered when the user selects the year portion | | select:month | () => void | Triggered when the user selects the month portion | | select:day | () => void | Triggered when the user selects the day portion |

🧩 Slots

title

Use this slot if you want to override the date picker title, an example being:

<date-picker v-model="date">
  <template
    #title="{
      date,
      selectYears,
      selectMonths,
      selectDays,
    }"
  >
    {{ date }}
  </template>
</date-picker>

There are a few props being exposed:

| Name | Type | Default | Description | | -------------- | ---------- | ------- | --------------------------------------------------------------- | | date | string | null | Currently selected date | | selectYears | function | N/A | Helper function used for triggering the selection of the years | | selectMonths | function | N/A | Helper function used for triggering the selection of the months | | selectDays | function | N/A | Helper function used for triggering the selection of the days |