New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@uandi/vue-datetime

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uandi/vue-datetime

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

latest
Source
npmnpm
Version
1.0.0-beta.7
Version published
Maintainers
1
Created
Source

vue-datetime

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 disabling dates.

NOTICE: This README is related to next version (1.x) of vue-datetime. For the old release 0.x, see here.

Demo

Go to demo.

demo

TODO

v1.x currently support most of v0.x functionality but it's still behind.

Old features not yet implemented:

  • Disabled dates
  • Time picker (Not sure if it will be implemented)

Installation

Bundler (Webpack, Rollup...)

yarn add luxon vue-datetime weekstart

Or

npm install --save luxon vue-datetime weekstart

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

Register

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

Vue.use(Datetime)

Register manually

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

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

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

Browser

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

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

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

Usage

Minimal

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

Setup

Parameters

ParameterTypeDefaultDescription
v-model (required)ISO 8601 String-Datetime.
typeStringdatePicker type. date or datetime.
input-idString''Id for the input.
input-classString''Class for the input.
hidden-nameStringnullName for hidden input with raw value. See #51.
value-zoneStringUTCTime zone for the value.
zoneStringlocalTime zone for the picker.
formatObject or StringDateTime.DATE_MED or DateTime.DATETIME_MEDInput date format. Luxon presents or tokens.
phrasesObject{ok: 'Ok', cancel: 'Cancel'}Phrases.
use12-hourBooleanfalseDisplay 12 hour (AM/PM) mode
hour-stepNumber1Hour step.
minute-stepNumber1Minute step.
min-datetimeISO 8601 StringnullMinimum datetime.
max-datetimeISO 8601 StringnullMaximum datetime.
autoBooleanfalseAuto continue/close on select.
week-startNumberauto from locale if weekstart is available or 1First day of the week. 1 is Monday and 7 is Sunday.

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

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.

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

Keywords

datetime

FAQs

Package last updated on 09 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts