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

VueCtkDateTimePicker

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

This documentation is for v2.*. Find v1 documentation here

This is image title

Dark mode

This is image title

Demo

Enjoy

Installation

Yarn

source-shell
yarn add vue-ctk-date-time-picker

NPM

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

Usage

ES6 Modules / CommonJS

source-js
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);
text-html-basic
<VueCtkDateTimePicker v-model="yourValue" />

UMD

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

<div id="app">
  <VueCtkDateTimePicker v-model="yourValue"></VueCtkDateTimePicker>
</div>

<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('vue-ctk-date-time-picker', window['vue-ctk-date-time-picker']);
  new Vue({
    el: '#app',
    data() {
      return {
        yourValue: null
      };
    }
  });
</script>

Here is an example of UMD implementation.

Use custom element to trigger the component

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

Props API

Props Type Required Default
v-model String yes -
format String no ‘YYYY-MM-DD hh:mm a’
formatted String no ‘llll’ (momentjs format)
label String no Select date & time
hint (1) String no -
error (2) Boolean no false
color (3) String (hex) no dodgerblue
button-color (4) String (hex) no #00C853
position String no null
locale (5) String no Browser Locale
persistent Boolean no false
minute-interval Integer no 1
output-format String no null
only-time Boolean no false
only-date Boolean no false
no-label Boolean no false
no-header Boolean no false
no-value-to-custom-elem (6) Boolean no false
min-date (7) String no -
max-date (7) String no -
no-weekends-days Boolean no false
auto-close Boolean no false
inline Boolean no false
overlay Boolean no false
range Boolean no false
dark Boolean no false
no-shortcuts Boolean no false
no-button Boolean no false
input-size String (sm or lg) no null
button-now-translation String no ‘Now’
no-button-now Boolean no false
first-day-of-week Int (0 to 7) no -
disabled-dates (8) Array<string> no []
disabled-hours (9) Array<string> no -
shortcut String no -
custom-shortcuts (10) Array<object> no -
disabled-weekly (11) Array<integer> no []
no-keyboard (12) Boolean no false
right (13) Boolean no false
noClearButton Boolean no false
behaviour Object no See behaviour
id (14) String no undefined

(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) no-value-to-custom-elem : No value will set to your elem (you can get the formatted value with @formatted-value event)

(7) min-date && max-date should be in the same format as property format specified. If format not set - it is set to ‘YYYY-MM-DD hh:mm a’ by default

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

(9) 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']

(10) custom-shortcuts - It’s an array of objects. Each object represents a single shortcut.

source-js
[
  { key: 'thisWeek', label: 'This week', value: 'isoWeek' },
  { key: 'lastWeek', label: 'Last week', value: '-isoWeek' },
  { key: 'last7Days', label: 'Last 7 days', value: 7 },
  { key: 'last30Days', label: 'Last 30 days', value: 30 },
  { key: 'thisMonth', label: 'This month', value: 'month' },
  { key: 'lastMonth', label: 'Last month', value: '-month' },
  { key: 'thisYear', label: 'This year', value: 'year' },
  { key: 'lastYear', label: 'Last year', value: '-year' }
];

Shortcut types allowed are : ['day', '-day', 'isoWeek', '-isoWeek', 'quarter', 'month', '-month', 'year', '-year', 'week', '-week'] For each shortcut, a key, label and value must be specified. The key is a unique key for that specific shortcut. Additional values can be passed as a callback function that will be called whenever the user clicks on the shortcut. The callback receives an object as first argument with the start and end values, with the shortcut object itself. You can use this feature for translate existings shortcuts. If the value of shortcut is a number (Integer), this number correspond to number of day (for 5 --> Last 5 days).

If the value of shortcut is a function, we’ll use it to generate the start and end values. This function should return an object with the start & end values. Both values must be a moment object. The function is called when the user clicks on the shortcut button.

source-js
[
  {
    key: 'customValue',
    label: 'My custom thing',
    value: () => {
      return {
        start: moment(),
        end: moment().add(2, 'days')
      }
    },
    callback: ({ start, end }) => {
      console.log('My shortcut was clicked with values: ', start, end)
    }
  },
];

With the shortcut property, you can specify a shortcut that’s selected by default by passing it’s key value.

source-js
  :shortcut="'thisMonth'"

(11) disabled-weekly : Days of the week which are disabled every week, in Array format with day index, Sunday as 0 and Saturday as 6: [0,4,6]

(12) no-keyboard : Disable keyboard accessibility & navigation

(13) right : add this attribute to align the picker on right

(14) id : it assign id such as ‘passedstring-input’ to input help diffrentiate between two date-time-picker on same component.

Any additionnal attribute passed to the component will be automatically be binded to the input component. (eg. if you passes a type attribute, the <input> will receive it).

Behaviour

In order to avoid having too much properties in the component, We’re adding a behaviour property that is an object including some annex behaviour values.

The default value for this object is:

source-js
{
  time: {
    nearestIfDisabled: true;
  }
}

To override those values, pass a new object with the values you want to override:

text-html-basic
<ctk-date-time-picker
  :behaviour="{
    time: {
      nearestIfDisabled: false
    }
  }"
/>
Behaviour Description Type Default
time.nearestIfDisabled If true, it will select the nearest available hour in the timepicker, if the current selected hour is disabled. Per example, if the hour is 12 but all the hours have been disabled until 14, then the 14 will be selected by default. Set false to disable this behaviour; the current hour will remain selected even if it has been disabled. The user cannot re-select it. Boolean true

Events API

Event Return
input value (formatted with ‘format’ props)
formatted-value value (formatted with ‘formatted’ props)
is-shown Component is shown
is-hidden Component is hidden
validate Click on validate button (so component is closed)
destroy Component is destroy

Keyboard Accessible

Key Action
Arrow Right Next Day
Arrow Left Previous Day
Arrow Down Same day on next week
Arrow Up Same day on previous week
Page Down Same day on previous month
Page Up Same day on next month
Enter or Space Select day
Escape Close component

Upcoming features (Todo)

  • Double Calendar on RangeDatePicker (issue : #33)
  • Inputs Text to choose values (issue #30)
  • TimePicker seconds support (issue : #79)

Contribute

Setting up development server

Without Docker

Ensure you have Node and npm in your machine. Minimal config is:

  • node >= 6.0
  • npm >= 3.0

This project is built with node@10.x.

Install the development dependencies by running:

source-shell
npm install

or

source-shell
npm ci # Recommanded if you have node > 10.x

Once your dependencies are installed, start the development server with:

source-shell
npm run serve

This will start the development server available at http://localhost:8080.

Docker

To easily set-up your development environment, you can spin up a container containing the development app. For that, you need Docker with docker-compose in your machine.

Once you’ve everything running, you can simply run the following command to start the dev server:

source-shell
docker-compose up -d

This will start the development server inside a container and accessible through http://localhost:8080.

Compiles and hot-reloads for development

source-shell
npm run serve

Linter

source-shell
npm run lint

Tests

Work in progress

License

This project is licensed under MIT License

Credit

Open source time proudly sponsored by Chronotruck

Github

https://github.com/chronotruck/vue-ctk-date-time-picker

#vuejs #javascript #vue-js

What is GEEK

Buddha Community

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

Avav Smith

1578417846

Collection of 14 Vue Select Component for Vue.js App

Vue select component can handle multiple selections. It’s enabled with the multiple property. Like with the single selection, you can pull out the new value by accessing event. target. value in the onChange callback.

1. Vue GridMultiselect

Simple multi-select component with items displayed in a table like UI.

Vue GridMultiselect

Demo

Download


2. vue-select

Everything you wish the HTML <select> element could do, wrapped up into a lightweight, extensible Vue component.

Vue Select is a feature rich select/dropdown/typeahead component.

Features

  • Tagging
  • Filtering / Searching
  • Vuex Support
  • AJAX Support
  • SSR Support
  • ~20kb Total / ~5kb CSS / ~15kb JS
  • Select Single/Multiple Options
  • Customizable with slots and SCSS variables
  • Tested with Bootstrap 3/4, Bulma, Foundation
  • +95% Test Coverage
  • Zero dependencies

vue-select

Demo

Download


3. @desislavsd/vue-select

Lightweight and mighty select component like Chosen and Select 2 done the Vue way.

Features

  • Uses v-model
  • Single / Multiple selection
  • Tagging + custom key triggers
  • List Filtering / Searching
  • Support for async list source
  • Out of the box AJAX support using fetch
  • Debounce AJAX requests
  • Transparent access to input attributes
  • Highly customizable
  • Zero dependencies

esislavsd/vue-select

Demo

Download


4. v-super-select

An accessible and customizable select/drop down component that features searching, grouping, and virtual scrolling.

v-super-select

Demo

Download


5. vue-dynamic-select

A VueJS plugin that provides a searchable and reactive select list component with no dependencies.

vue-dynamic-select

Download


6. @alfsnd/vue-bootstrap-select

A vue version of bootstrap select

alfsnd/vue-bootstrap-select

Demo

Download


7. vue-selectize

Vanila Vue.js component that mimics Selectize behaviour (no need jquery dependency)

vue-selectize

Demo

Download


8. vue2-selectize

A Selectize wrapper for VueJS 2.

vue2-selectize

Demo

Download


9. v-suggest

A Vue2 plugin for input content suggestions, support keyboard to quick pick.

v-suggest

Demo

Download


10. vue-multi-select

This component gives you a multi/single select with the power of Vuejs components.

vue-multi-select

Demo

Download


11. v-cascade

A lovely component of cascade selector with vue.js (Support both of PC and Mobile)

v-cascade

Demo

Download


12. stf vue select VUE2

stf vue select - most flexible and customized select

For detailed explanation on how things work, checkout the DEMO

stf vue select VUE2

Demo

Download


13. Advanced Vue.js Chained Select

Using Vue.js to chain mulitiple select inputs together.

Advanced Vue.js Chained Select

Demo


14. Vue Select2

A native Vue.js component that provides similar functionality to Select2 without the overhead of jQuery.

Rather than bringing in jQuery just to use Select2 or Chosen, this Vue.js component provides similar functionality without the extra overhead of jQuery, while providing the same awesome data-binding features you expect from Vue. Vue-select has no JavaScript dependencies other than Vue, and is designed to mimic Select2.

Vue Select2

Demo

Download


Thank for read!

#vue-select #vue-select-component #vue-js #select-component

Hal  Sauer

Hal Sauer

1591688078

Python Datetime Tutorial: Manipulate Times, Dates, and Time Spans

Dealing with dates and times in Python can be a hassle. Thankfully, there’s a built-in way of making it easier: the Python datetime module.

datetime helps us identify and process time-related elements like dates, hours, minutes, seconds, days of the week, months, years, etc. It offers various services like managing time zones and daylight savings time. It can work with timestamp data. It can extract the day of the week, day of the month, and other date and time formats from strings.

#data science tutorials #calendar #date #dates #datetime #intermediate #python #time #time series #times #tutorial #tutorials

A Vue Picker Component of The Mobile Terminal

A picker component for vue2.0

After walking around GitHub, I didn’t find the vue-picker component of the mobile terminal I wanted. So I started, took one out and felt the effect.

A picker component

Install

npm install vue-pickers --save or yarn add vue-pickers

Use

<template>
  <div>
    <button @click="show">show picker</button>
    <VuePicker :data="pickData"
      :showToolbar="true"
      @cancel="cancel"
      @confirm="confirm"
      :visible.sync="pickerVisible"
    />
  </div>
</template>

<script>
  import VuePicker from 'vue-pickers'
  var tdata = []
  for (let i = 0; i < 20; i++) {
    tdata.push({
      label: 'The' + i + 'row',
      value: i
    })
  }
  export default {
    components: {
      VuePicker
    },
    data () {
      return {
        pickerVisible: false,
        pickData: [
          tdata
        ],
        result: ''
      }
    },
    methods: {
      show () {
        this.pickerVisible = true
      },
      cancel () {
        this.result = 'click cancel result: null'
      },
      confirm (res) {
        this.result = JSON.stringify(res)
      }
    }
  }
</script>

Attributes

Attribute Description require Type Default
visible show/hide picker yes Boolean false
data pickerData,colums[data1, data2] yes Array []
layer linkage column no Number 0
link open linkage data no Boolean false
defaultIndex default index no Number/Array(for more colums)
cancelText cancel text no String ‘取消’
confirmText confirm text no String ‘确认’
title picker title no String ‘’
showToolbar show toolbar no Boolean false
maskClick click mask no Boolean false

Events

Event Name Description require Type Default
change select change no function(val) -
cancel cancel button click no function -
confirm confirm button click no function(val) -

Download

#vue-picker #vue-js #vue-picker-component

Luna  Mosciski

Luna Mosciski

1600583123

8 Popular Websites That Use The Vue.JS Framework

In this article, we are going to list out the most popular websites using Vue JS as their frontend framework.

Vue JS is one of those elite progressive JavaScript frameworks that has huge demand in the web development industry. Many popular websites are developed using Vue in their frontend development because of its imperative features.

This framework was created by Evan You and still it is maintained by his private team members. Vue is of course an open-source framework which is based on MVVM concept (Model-view view-Model) and used extensively in building sublime user-interfaces and also considered a prime choice for developing single-page heavy applications.

Released in February 2014, Vue JS has gained 64,828 stars on Github, making it very popular in recent times.

Evan used Angular JS on many operations while working for Google and integrated many features in Vue to cover the flaws of Angular.

“I figured, what if I could just extract the part that I really liked about Angular and build something really lightweight." - Evan You

#vuejs #vue #vue-with-laravel #vue-top-story #vue-3 #build-vue-frontend #vue-in-laravel #vue.js

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

VueCtkDateTimePicker

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

This documentation is for v2.*. Find v1 documentation here

This is image title

Dark mode

This is image title

Demo

Enjoy

Installation

Yarn

source-shell
yarn add vue-ctk-date-time-picker

NPM

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

Usage

ES6 Modules / CommonJS

source-js
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);
text-html-basic
<VueCtkDateTimePicker v-model="yourValue" />

UMD

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

<div id="app">
  <VueCtkDateTimePicker v-model="yourValue"></VueCtkDateTimePicker>
</div>

<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('vue-ctk-date-time-picker', window['vue-ctk-date-time-picker']);
  new Vue({
    el: '#app',
    data() {
      return {
        yourValue: null
      };
    }
  });
</script>

Here is an example of UMD implementation.

Use custom element to trigger the component

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

Props API

Props Type Required Default
v-model String yes -
format String no ‘YYYY-MM-DD hh:mm a’
formatted String no ‘llll’ (momentjs format)
label String no Select date & time
hint (1) String no -
error (2) Boolean no false
color (3) String (hex) no dodgerblue
button-color (4) String (hex) no #00C853
position String no null
locale (5) String no Browser Locale
persistent Boolean no false
minute-interval Integer no 1
output-format String no null
only-time Boolean no false
only-date Boolean no false
no-label Boolean no false
no-header Boolean no false
no-value-to-custom-elem (6) Boolean no false
min-date (7) String no -
max-date (7) String no -
no-weekends-days Boolean no false
auto-close Boolean no false
inline Boolean no false
overlay Boolean no false
range Boolean no false
dark Boolean no false
no-shortcuts Boolean no false
no-button Boolean no false
input-size String (sm or lg) no null
button-now-translation String no ‘Now’
no-button-now Boolean no false
first-day-of-week Int (0 to 7) no -
disabled-dates (8) Array<string> no []
disabled-hours (9) Array<string> no -
shortcut String no -
custom-shortcuts (10) Array<object> no -
disabled-weekly (11) Array<integer> no []
no-keyboard (12) Boolean no false
right (13) Boolean no false
noClearButton Boolean no false
behaviour Object no See behaviour
id (14) String no undefined

(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) no-value-to-custom-elem : No value will set to your elem (you can get the formatted value with @formatted-value event)

(7) min-date && max-date should be in the same format as property format specified. If format not set - it is set to ‘YYYY-MM-DD hh:mm a’ by default

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

(9) 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']

(10) custom-shortcuts - It’s an array of objects. Each object represents a single shortcut.

source-js
[
  { key: 'thisWeek', label: 'This week', value: 'isoWeek' },
  { key: 'lastWeek', label: 'Last week', value: '-isoWeek' },
  { key: 'last7Days', label: 'Last 7 days', value: 7 },
  { key: 'last30Days', label: 'Last 30 days', value: 30 },
  { key: 'thisMonth', label: 'This month', value: 'month' },
  { key: 'lastMonth', label: 'Last month', value: '-month' },
  { key: 'thisYear', label: 'This year', value: 'year' },
  { key: 'lastYear', label: 'Last year', value: '-year' }
];

Shortcut types allowed are : ['day', '-day', 'isoWeek', '-isoWeek', 'quarter', 'month', '-month', 'year', '-year', 'week', '-week'] For each shortcut, a key, label and value must be specified. The key is a unique key for that specific shortcut. Additional values can be passed as a callback function that will be called whenever the user clicks on the shortcut. The callback receives an object as first argument with the start and end values, with the shortcut object itself. You can use this feature for translate existings shortcuts. If the value of shortcut is a number (Integer), this number correspond to number of day (for 5 --> Last 5 days).

If the value of shortcut is a function, we’ll use it to generate the start and end values. This function should return an object with the start & end values. Both values must be a moment object. The function is called when the user clicks on the shortcut button.

source-js
[
  {
    key: 'customValue',
    label: 'My custom thing',
    value: () => {
      return {
        start: moment(),
        end: moment().add(2, 'days')
      }
    },
    callback: ({ start, end }) => {
      console.log('My shortcut was clicked with values: ', start, end)
    }
  },
];

With the shortcut property, you can specify a shortcut that’s selected by default by passing it’s key value.

source-js
  :shortcut="'thisMonth'"

(11) disabled-weekly : Days of the week which are disabled every week, in Array format with day index, Sunday as 0 and Saturday as 6: [0,4,6]

(12) no-keyboard : Disable keyboard accessibility & navigation

(13) right : add this attribute to align the picker on right

(14) id : it assign id such as ‘passedstring-input’ to input help diffrentiate between two date-time-picker on same component.

Any additionnal attribute passed to the component will be automatically be binded to the input component. (eg. if you passes a type attribute, the <input> will receive it).

Behaviour

In order to avoid having too much properties in the component, We’re adding a behaviour property that is an object including some annex behaviour values.

The default value for this object is:

source-js
{
  time: {
    nearestIfDisabled: true;
  }
}

To override those values, pass a new object with the values you want to override:

text-html-basic
<ctk-date-time-picker
  :behaviour="{
    time: {
      nearestIfDisabled: false
    }
  }"
/>
Behaviour Description Type Default
time.nearestIfDisabled If true, it will select the nearest available hour in the timepicker, if the current selected hour is disabled. Per example, if the hour is 12 but all the hours have been disabled until 14, then the 14 will be selected by default. Set false to disable this behaviour; the current hour will remain selected even if it has been disabled. The user cannot re-select it. Boolean true

Events API

Event Return
input value (formatted with ‘format’ props)
formatted-value value (formatted with ‘formatted’ props)
is-shown Component is shown
is-hidden Component is hidden
validate Click on validate button (so component is closed)
destroy Component is destroy

Keyboard Accessible

Key Action
Arrow Right Next Day
Arrow Left Previous Day
Arrow Down Same day on next week
Arrow Up Same day on previous week
Page Down Same day on previous month
Page Up Same day on next month
Enter or Space Select day
Escape Close component

Upcoming features (Todo)

  • Double Calendar on RangeDatePicker (issue : #33)
  • Inputs Text to choose values (issue #30)
  • TimePicker seconds support (issue : #79)

Contribute

Setting up development server

Without Docker

Ensure you have Node and npm in your machine. Minimal config is:

  • node >= 6.0
  • npm >= 3.0

This project is built with node@10.x.

Install the development dependencies by running:

source-shell
npm install

or

source-shell
npm ci # Recommanded if you have node > 10.x

Once your dependencies are installed, start the development server with:

source-shell
npm run serve

This will start the development server available at http://localhost:8080.

Docker

To easily set-up your development environment, you can spin up a container containing the development app. For that, you need Docker with docker-compose in your machine.

Once you’ve everything running, you can simply run the following command to start the dev server:

source-shell
docker-compose up -d

This will start the development server inside a container and accessible through http://localhost:8080.

Compiles and hot-reloads for development

source-shell
npm run serve

Linter

source-shell
npm run lint

Tests

Work in progress

License

This project is licensed under MIT License

Credit

Open source time proudly sponsored by Chronotruck

Github

https://github.com/chronotruck/vue-ctk-date-time-picker

#vuejs #javascript #vue-js