![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
vuejs-timepicker
Advanced tools
A dropdown time picker (hour|minute|second) for Vue 2.x, with flexible time format support. Fork of the now-unmaintained vue2-timepicker package.
A dropdown time picker (hour|minute|second) for Vue 2.x, with flexible time format support. Fork of the now-unmaintained vue2-timepicker package.
You can see the Vue2 Timepicker in action in the Demo Page
Vue.js v2.0+
Through NPM (Recommended)
npm install git+https://github.com/xxRockOnxx/vue2-timepicker.git --save-dev
Bower
bower install https://github.com/xxRockOnxx/vue2-timepicker.git#master --save-dev
Step 1: Import VueTimepicker
A: Include the single file component (Recommended)
// import
import VueTimepicker from 'vuejs-timepicker'
// Or, require
var VueTimepicker = require('vuejs-timepicker')
or, B: Include distribution files with <script>
and <style>
<script src="yourpath/vue/dist/vue.min.js"></script>
<script src="yourpath/vuejs-timepicker/dist/vue2-timepicker.min.js"></script>
<link href="yourpath/vuejs-timepicker/dist/vue2-timepicker.min.css" rel="stylesheet"></link>
NOTE: When using the dist
files, a Vue.use()
call is needed
// Work with <script> block
Vue.use(window.VueTimepicker)
// Else
Vue.use(VueTimepicker)
Step 2: Include VueTimepicker in your component
var yourComponent = new Vue({
components: { VueTimepicker },
...
})
Step 3: Then, you can introduce the vue-timepicker
tag anywhere you like in your component's template
<vue-timepicker></vue-timepicker>
<!-- Default to 24-Hour format HH:mm -->
<vue-timepicker></vue-timepicker>
<!-- Show seconds picker -->
<vue-timepicker format="HH:mm:ss"></vue-timepicker>
<!-- 12-hour format, with AM/PM picker -->
<vue-timepicker format="hh:mm A"></vue-timepicker>
<!-- 12-hour format, with seconds picker and am/pm picker -->
<vue-timepicker format="hh:mm:ss a"></vue-timepicker>
VueTimepicker will recognizes the following tokens in the format string
Section | Token | Output |
---|---|---|
AM/PM | A | AM PM |
a | am pm | |
Hour | H | 0 1 ... 22 23 |
HH | 00 01 ... 22 23 | |
h | 1 2 ... 11 12 | |
hh | 01 02 ... 11 12 | |
k | 1 2 ... 23 24 | |
kk | 01 02 ... 23 24 | |
Minute | m | 0 1 ... 58 59 |
mm | 00 01 ... 58 59 | |
Second | s | 0 1 ... 58 59 |
ss | 00 01 ... 58 59 |
If not set,
format
string will be default to "HH:mm"
<!-- Show minute picker's value in the form of 0, 5, 10, ... 55, 60 -->
<vue-timepicker :minute-interval="5"></vue-timepicker>
<!-- Show second picker's value in the form of 0, 10, 20, ... 50, 60 -->
<vue-timepicker :second-interval="10"></vue-timepicker>
<!-- Bind interval config with your own data variable -->
<vue-timepicker :minute-interval="yourMinuteInterval"></vue-timepicker>
Note: Please do remember to add the :
or v-bind:
sign before the interval properties
<vue-timepicker hide-clear-button></vue-timepicker>
v-model
// e.g. If you want to assign "10:05:00" as the initial value of vue-timepicker
var yourComponent = new Vue({
components: { VueTimepicker },
data: function () {
return {
yourTimeValue: {
HH: "10",
mm: "05",
ss: "00"
},
...
}
},
...
})
<!-- HTML -->
<vue-timepicker v-model="yourTimeValue" format="HH:mm:ss"></vue-timepicker>
v-model
<!-- In the last section, we've set the initial value (yourTimeValue) to "10:05:00" -->
<vue-timepicker v-model="yourTimeValue" format="HH:mm:ss"></vue-timepicker>
// Then, open the dropdown picker and pick a new time.
// Like setting to "14:30:15" for example
// Check the value after that
console.log(this.yourTimeValue)
// outputs -> {HH: "14", mm: "30", ss: "15"}
@change
event handler<!-- A: No argument -->
<vue-timepicker :time-value.sync="yourTimeValue" @change="changeHandler"></vue-timepicker>
<!-- B: Custom arguments -->
<vue-timepicker :time-value.sync="yourTimeValue" @change="otherChangeHandler($event, 'foo', 'bar')"></vue-timepicker>
// A: No argument
changeHandler (eventData) {
console.log(eventData)
// -> {data: {HH:..., mm:... }}
}
// B: Custom arguments
otherChangeHandler (eventData, yourArg1, yourArg2) {
console.log(eventData)
// -> {data: {HH:..., mm:... }}
console.log(yourArg1)
// -> 'foo'
console.log(yourArg2)
// -> 'bar'
}
Unlike v-model
, which only returns the defined time tokens you provided in the binding variable, the change
event will return all supported formats.
In the example above, when picker is set to "14:30:15" in HH:mm:ss format, change
event will return the following data:
// `@change` event data
{
HH: "14",
H: "14",
hh: "14",
a: "am",
A: "AM",
h: "14",
kk: "14",
k: "14",
m: "30",
mm: "30",
s: "15",
ss: "15"
}
Whereas the v-model
will only return the data with defined tokens
// Previously defined variable (`yourTimeValue` in this case) as {HH:..., mm:..., ss:...}
// Hence, the `v-model` returns:
{
HH: "14",
mm: "30",
ss: "15"
}
Prop | Type | Required | Default Value |
---|---|---|---|
v-model | Object | no | undefined |
format | String | no | "HH:mm" |
minute-interval | Number | no | undefined |
second-interval | Number | no | undefined |
hide-clear-button | Boolean | no | false |
disabled | Boolean | no | undefined |
disabledValues | Object | no | { hours: [], minute: [], second: [], apm: [] } |
Please feel free to fork and help developing.
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
For detailed explanation on how things work, checkout the webpack guide and docs for vue-loader.
Detail changes for each release are documented in CHANGELOG.md
v 0.1.4
Added stop propagation .stop
to click events
FAQs
A dropdown time picker (hour|minute|second) for Vue 2.x, with flexible time format support. Fork of the now-unmaintained vue2-timepicker package.
We found that vuejs-timepicker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.