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-datetime-extended

v1.0.4

Published

Mobile friendly datetime picker for Vue. Supports date, datetime and time modes, i18n and disabling dates.

Downloads

48

Readme

vue-datetime-extended

Software License Latest Version on NPM npm Vue 2.x Build Coverage

Mobile friendly datetime picker for Vue. Supports date, datetime and time modes, i18n and more.

Demo

Go to demo.

demo

Installation

Bundler (Webpack, Rollup...)

yarn add luxon vue-datetime-extended weekstart

Or

npm install --save luxon vue-datetime-extended weekstart

weekstart is optional, is used to get the first day of the week.

Register

import Vue from 'vue'
import { Datetime } from 'vue-datetime-extended'
// You need a specific loader for CSS files
import 'vue-datetime-extended/dist/vue-datetime-extended.css'

Vue.use(Datetime)

Register manually

Global
import { Datetime } from 'vue-datetime-extended';

Vue.component('datetime-extended', Datetime);
Local
import { Datetime } from 'vue-datetime-extended';

Vue.extend({
  template: '...',
  components: {
    'datetime-extended': Datetime
  }
});

Browser

Download vue, luxon, weekstart and vue-datetime-extended or use a CDN like unpkg.

<link rel="stylesheet" href="vue-datetime-extended.css"></link>
<script src="vue.js"></script>
<script src="luxon.js"></script>
<script src="weekstart.js"></script>
<script src="vue-datetime-extended.js"></script>

The component registers itself automatically as <datetime-extended>. If you want to use a different name then register it explicitly:

Vue.component('vue-datetime', window.VueDatetimeExtended.Datetime);

weekstart is optional, is used to get the first day of the week.

Usage

Minimal

<datetime-extended v-model="date"></datetime-extended>

Setup

Parameters

Parameter | Type | Default | Description --------- | ---- | ------- | ----------- v-model (required) | ISO 8601 String | - | Datetime. type | String | date | Picker type: date, datetime or time. input-id | String | '' | Id for the input. input-class | String, Array or Object | '' | Class for the input. input-style | String, Array or Object | '' | Style for the input. hidden-name | String | null | Name for hidden input with raw value. See #51. value-zone | String | UTC | Time zone for the value. zone | String | local | Time zone for the picker. format | Object or String | DateTime.DATE_MED, DateTime.DATETIME_MED or DateTime.TIME_24_SIMPLE | Input date format. Luxon presets or tokens. phrases | Object | {ok: 'Ok', cancel: 'Cancel'} | Phrases. use12-hour | Boolean | false | Display 12 hour (AM/PM) mode hour-step | Number | 1 | Hour step. minute-step | Number | 1 | Minute step. min-datetime | ISO 8601 String | null | Minimum datetime. max-datetime | ISO 8601 String | null | Maximum datetime. auto | Boolean | false | Auto continue/close on select. week-start | Number | auto from locale if weekstart is available or 1 | First day of the week. 1 is Monday and 7 is Sunday. flow | Array | Depends of type | Customize steps flow, steps available: time, date, month, year. Example: ['year', 'date', 'time'] title | String | '' | Popup title. hide-backdrop | Boolean | false | Show/Hide backdrop. backdrop-click | Boolean | true | Enable/Disable backdrop click to cancel (outside click). disable-week-days | String or Array | '' | Disable weekdays 0-6 (Sun-Sat) or 1-7 (Mon-Sun) or week day names (English). Can be comma-separated string e.g., "6,7" or array [6,7]. disable-days | String or Array | '' | Disable certain dates. Each date must be in yyyy-mm-dd format. Can be comma-separated string or array of dates e.g., "2023-12-25,2024-01-01" or ["2023-12-25", "2024-01-01"].

Input inherits all props not defined above but style and class will be inherited by root element. See inheritAttrs option

The component is based on Luxon, check out documentation to set time zones and format.

Internationalization

Date internationalization depends on luxon. Set the default locale.

import { Settings } from 'luxon'

Settings.defaultLocale = 'es'

Events

Component emits the input event to work with v-model. More info.

close event is emitted when the popup closes.

Also, input text inherits all component events.

Slots

You can customize the component using named slots.

Available slots: before, after, button-cancel and button-confirm

Button customization example:

<datetime v-model="date" input-id="startDate">
  <label for="startDate" slot="before">Field Label</label>
  <span class="description" slot="after">The field description</span>
  <template slot="button-cancel">
    <fa :icon="['far', 'times']"></fa>
    Cancel
  </template>
  <template slot="button-confirm">
    <fa :icon="['fas', 'check-circle']"></fa>
    Confirm
  </template>
</datetime>

You can also use slot-scope to determine which view is currently active:

<template slot="button-confirm" slot-scope="scope">
  <span v-if='scope.step === "date"'>Next <i class='fas fa-arrow-right' /></span>
  <span v-else><i class='fas fa-check-circle' /> Publish</span>
</template>

Theming

Theming is supported by overwriting CSS classes.

Development

Launch lint and tests

yarn test

Launch visual tests

yarn dev

Build

Bundle the js and css to the dist folder:

yarn build

License

The MIT License