All Projects → mariomka → Vue Datetime

mariomka / Vue Datetime

Licence: mit
Mobile friendly datetime picker for Vue. Supports date and datetime modes, i18n and more.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Datetime

Angular Moment Picker
Angular Moment Picker is an AngularJS directive for date and time picker using Moment.js.
Stars: ✭ 536 (-42.24%)
Mutual labels:  time, date, datetime, datepicker, timepicker
nativescript-datetimepicker
Plugin with date and time picking fields
Stars: ✭ 26 (-97.2%)
Mutual labels:  time, date, timepicker, datepicker, datetimepicker
popoPicker
popoPicker是一个移动端3D滚轮日期时间和单项的选择器,支持无限循环滚动,不依赖第三方库
Stars: ✭ 26 (-97.2%)
Mutual labels:  time, date, timepicker, datepicker, datetimepicker
Vue Ctk Date Time Picker
VueJS component to select dates & time, including a range mode
Stars: ✭ 707 (-23.81%)
Mutual labels:  time, date, datepicker, timepicker
Angular Bootstrap Datetimepicker
Native Angular date/time picker component styled by Twitter Bootstrap
Stars: ✭ 1,289 (+38.9%)
Mutual labels:  datetime, datepicker, timepicker, datetimepicker
vue-timeselector
🕒 Simply customizable powerful time picker for Vue.js
Stars: ✭ 41 (-95.58%)
Mutual labels:  time, datetime, date, timepicker
Rc Datetime Picker
React component for datetime picker by Moment.js
Stars: ✭ 85 (-90.84%)
Mutual labels:  date, datetime, datepicker, datetimepicker
Laydate
layDate(日期与时间组件) 是 layui 独立维护的三大组件之一
Stars: ✭ 1,066 (+14.87%)
Mutual labels:  time, date, datetime, datepicker
Tail.datetime
A lightweight, translat- and configurable Open Source DateTime Picker, written in pure vanilla JavaScript!
Stars: ✭ 139 (-85.02%)
Mutual labels:  time, date, datetime, datetimepicker
vue3-date-time-picker
Datepicker component for Vue 3
Stars: ✭ 157 (-83.08%)
Mutual labels:  datetime, timepicker, datepicker, datetimepicker
react-calendar-datetime-picker
A simple and fast date and time picker component for React
Stars: ✭ 58 (-93.75%)
Mutual labels:  datetime, date, timepicker, datepicker
Zebra datepicker
A super-lightweight, highly configurable, cross-browser date / time picker jQuery plugin
Stars: ✭ 367 (-60.45%)
Mutual labels:  date, datetime, datepicker, timepicker
Jedate
jeDate V6.5.0 是一款原生JS开发的 不依赖任何第三方库 大众化的日期控件,她身兼多职,虽不是万能的,但是她却是功能强大多样的美少女,她除了包含 单双面板、区域选择、 多语言、日历固定、有效无效日期、日期时间戳转换、日期加减、限制时分秒、初始化日期加减N、日期标注点、设定年月(YYYY-MM)、日期范围限制、开始日期设定、自定义日期格式、当天的前后若干天返回、时分秒选择、智能响应、自动纠错、节日识别,操作等常规功能外,根据不同的日期格式,显示不同内容,还拥有更多趋近完美的解决方案。更多的是需要你与她的亲密接触与呵护!
Stars: ✭ 433 (-53.34%)
Mutual labels:  date, datetime, datepicker, datetimepicker
Flatpickr
lightweight, powerful javascript datetimepicker with no dependencies
Stars: ✭ 14,575 (+1470.58%)
Mutual labels:  date, datetime, datepicker, timepicker
silverware-calendar
SilverWare Calendar Module
Stars: ✭ 15 (-98.38%)
Mutual labels:  time, date, timepicker, datepicker
svelty-picker
Simple date & time picker in svelte
Stars: ✭ 38 (-95.91%)
Mutual labels:  datetime, timepicker, datepicker, datetimepicker
inquirer-datepicker-prompt
Datepicker prompt for inquirer.js
Stars: ✭ 24 (-97.41%)
Mutual labels:  datetime, date, datepicker
Calendarview
An Easy to Use Calendar for iOS (Swift 5.0)
Stars: ✭ 429 (-53.77%)
Mutual labels:  date, datetime, datepicker
nepali-datetime
Python's core datetime inspired nepali datetime (BS date & NPT) package 🇳🇵
Stars: ✭ 36 (-96.12%)
Mutual labels:  time, datetime, date
Pendulum
Python datetimes made easy
Stars: ✭ 4,639 (+399.89%)
Mutual labels:  time, date, datetime

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 more.

Demo

Go to demo.

demo

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>

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

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

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

Usage

Minimal

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

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).

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].