Gathering detailed insights and metrics for vue-datetime3
Gathering detailed insights and metrics for vue-datetime3
Gathering detailed insights and metrics for vue-datetime3
Gathering detailed insights and metrics for vue-datetime3
Mobile friendly datetime picker for Vue. Supports date and datetime modes, i18n and more.
npm install vue-datetime3
Typescript
Module System
Node Version
NPM Version
TypeScript (59.55%)
Vue (37.89%)
CSS (1.77%)
HTML (0.79%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
336 Commits
3 Forks
1 Watchers
8 Branches
1 Contributors
Updated on Dec 14, 2023
Latest Version
1.0.16
Package Id
vue-datetime3@1.0.16
Unpacked Size
83.54 kB
Size
18.26 kB
File Count
21
NPM Version
9.2.0
Node Version
18.19.0
Published on
Mar 13, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Mobile friendly datetime picker for Vue. Supports date, datetime and time modes, i18n and more.
This is a fork and port of Vue 2 vue-datetime by mariomka to support Vue 3 and typescript. For older versions of Vue refer to aforementioned project.
1yarn add luxon vue-datetime3 weekstart
Or
1npm install --save luxon vue-datetime3 weekstart
weekstart is optional, is used to get the first day of the week.
1import createApp from 'vue' 2import createDatetime from 'vue-datetime' 3// You need a specific loader for CSS files 4import 'vue-datetime/dist/style.css' 5 6const app = createApp(); 7 8app.use(createDatetime());
1<datetime v-model="date"></datetime>
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). |
color | String | #3f51b5 | Color theme of the component |
fixed-date | Boolean | false | Enables 'datetime' to have fixed date, input acts like a time picker, returns datetime value |
fixed-time | Boolean | false | Enables 'datetime' to have fixed time, input acts like a date picker, returns datetime value |
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.
Date internationalization depends on luxon. Set the default locale.
1import { Settings } from 'luxon' 2 3Settings.defaultLocale = 'es'
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.
You can customize the component using named slots.
Available slots: before
, after
, button-cancel
and button-confirm
1<datetime v-model="date" input-id="startDate"> 2 <label for="startDate" slot="before">Field Label</label> 3 <span class="description" slot="after">The field description</span> 4 <template slot="button-cancel"> 5 <fa :icon="['far', 'times']"></fa> 6 Cancel 7 </template> 8 <template slot="button-confirm"> 9 <fa :icon="['fas', 'check-circle']"></fa> 10 Confirm 11 </template> 12</datetime>
You can also use slot-scope
to determine which view is currently active:
1<template slot="button-confirm" slot-scope="scope"> 2 <span v-if='scope.step === "date"'>Next <i class='fas fa-arrow-right' /></span> 3 <span v-else><i class='fas fa-check-circle' /> Publish</span> 4</template>
Theming is supported by defining a color
in props. color
should be a valid css
color option, it's default value is #3f51b5
.
1npm run test
Note: Currently not working. Tests need to be rewritten to ViTest.
1npm run demo
Bundle the js and css to the dist
folder:
1npm run build
No vulnerabilities found.
No security vulnerabilities found.