Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-ctk-date-time-picker

Package Overview
Dependencies
Maintainers
3
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-ctk-date-time-picker

A vue component for select date & time (by Chronotruck)

  • 2.0.0-rc5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6K
decreased by-60.01%
Maintainers
3
Weekly downloads
 
Created
Source

vue-ctk-date-time-picker

vue-ctk-date-time-picker

A vue component for select dates (range mode available) & time

vue-ctk-date-time-picker

Dark mode

vue-ctk-date-time-picker

Demo

Enjoy here

Installation

Yarn

yarn add vue-ctk-date-time-picker

NPM

npm i --save vue-ctk-date-time-picker

Usage

ES6 Modules / CommonJS

import VueCtkDateTimePicker from 'vue-ctk-date-time-picker';
import 'vue-ctk-date-time-picker/dist/vue-ctk-date-time-picker.css';

Vue.component('VueCtkDateTimePicker', VueCtkDateTimePicker);
<VueCtkDateTimePicker />

UMD

<link rel="stylesheet" type="text/css" href="${YOUR_PATH}/vue-ctk-date-time-picker.css">

<VueCtkDateTimePicker></VueCtkDateTimePicker>

<script src="https://unpkg.com/vue" charset="utf-8"></script>
<script src="${YOUR_PATH}/vue-ctk-date-time-picker.umd.min.js" charset="utf-8"></script>

<script type="text/javascript">
  Vue.component('VueCtkDateTimePicker', window['vue-ctk-date-time-picker']);
</script>

Here is an example of UMD implementation: https://codepen.io/louismazel/pen/jQWNzQ

Use custom element to trigger the component

<VueCtkDateTimePicker :no-value-to-custom-elem="(true|false)" />
  ...
  <input type="text" />
  ... or
  <button type="button">Label</button>
  ...
</VueCtkDateTimePicker>

Props API

PropsTypeRequiredDefault
v-modelStringyes-
idStringnoCtkDateTimePicker
labelStringnoSelect date & time
disabledBooleannofalse
hint (1)Stringno-
error (2)Booleannofalse
color (3)String (hex)nododgerblue
button-color (4)String (hex)no#00C853
positionStringnonull
locale (5)StringnoBrowser Locale
persistentBooleannofalse
minute-intervalIntegerno1
formattedStringno'llll' (momentjs format)
formatStringno-
output-formatStringnonull
time-zone (6)StringnoBrowser Time Zone
only-timeBooleannofalse
only-dateBooleannofalse
no-headerBooleannofalse
no-value-to-custom-elem (7)Booleannofalse
overlayBooleannotrue
min-date (8)Stringno-
max-date (8)Stringno-
no-weekends-daysBooleannofalse
auto-closeBooleannofalse
inlineBooleannofalse
overlayBooleannofalse
range-modeBooleannofalse
darkBooleannofalse
no-shortcutsBooleannofalse
no-buttonBooleannofalse
input-sizeString (sm or lg)nonull
button-now-translationStringno'Now'
no-button-nowBooleannofalse
first-day-of-weekInt (0 to 7)no-
disabled-dates (9)Array<string>no[]
disabled-hours (10)Array<string>no-
custom-shortcuts (11)Array<object>no-

(1) hint : Is a text that replaces the label/placeholder (Ex : Error designation)

(2) error : When is true --> Input border & label are red

(3) color: Replace color for the hint, the borders & picker color

(4) button-color: Replace color for the buttons on bottom (validation & 'now')

(5) locale : Default value is the locale of the browser - Ex : Set locale="fr" to force to French language

(6) time-zone : Default value is the time-zone of the browser - Ex : Set Europe/Paris to force to French TZ. Do not forget to use a format like this YYYY-MM-DDTHH:mm:ssZ to get the TZ

(7) no-value-to-custom-elem : No value will set to your elem (you can get the formatted value with @formatted-value event)

(8) min-date & max-date : Must be 'YYYY-MM-DD' format

(9) Disabled-Dates is an Array of dates in 'YYYY-MM-DD' format (ex: ['2018-04-03', '2018-04-07', '2018-04-09'])

(10) disabled-hours : Must be an Array of hours in 24h format ('00' to '23') : ['00','01','02','03','04','05','06','07','19','20','21','22','23']

(11) custom-shortcuts - It's an Array of Objects like this :

[
  { label: `Aujourd'hui`, value: 'day', isSelected: false },
  { label: 'Yesterday', value: '-day', isSelected: false },
  { label: 'This Week', value: 'week', isSelected: true },
  { label: 'Last Week', value: '-week', isSelected: false },
  { label: 'This iso Week', value: 'isoWeek', isSelected: true },
  { label: 'Last iso Week', value: '-isoWeek', isSelected: false },
  { label: 'This Month', value: 'month', isSelected: false },
  { label: 'Last Month', value: '-month', isSelected: false },
  { label: 'This Month', value: 'year', isSelected: false },
  { label: 'Last Month', value: '-year', isSelected: false },
  { label: 'Last 5 days', value: 5, isSelected: false }
]

Shortcut types allowed : ['day', '-day', 'isoWeek', '-isoWeek', 'month', '-month', 'year', '-year', 'week', '-week'] If the value of shortcut is a number (Integer), this number correspond to number of day (for 5 --> Last 5 days) You can use this feature for translate the shortcuts When you set isSelected to true, the shortcut is selected by default

Events API

EventReturn
inputvalue (formatted with 'format' props)
formatted-valuevalue (formatted with 'formatted' props)
is-shownComponent is shown
is-hiddenComponent is hidden
validateClick on validate button (so component is closed)
destroyComponent is destoyr

Upcoming features (Todo)

  • Double Calendar on RangeDatePicker
  • Inputs Text to choose values (Issue #30)
  • Keyboard Accessibility
  • Select Year directly on DatePicker

Contribution

Project setup

npm install

Compiles and hot-reloads for development

npm run serve

Lints and fixes files

npm run lint

Keywords

FAQs

Package last updated on 03 Jan 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc