# @easepick/time-plugin
TIP
This package does not need to be installed if you are using @easepick/bundle.
Adds time picker.
# Quick example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>easepick</title>
<script src="https://cdn.jsdelivr.net/npm/@easepick/datetime@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/base-plugin@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/time-plugin@[version.number]/dist/index.umd.min.js"></script>
</head>
<body>
<input id="datepicker"/>
<script>
const picker = new easepick.create({
element: document.getElementById('datepicker'),
css: [
'https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.css',
'https://cdn.jsdelivr.net/npm/@easepick/time-plugin@[version.number]/dist/index.css',
],
plugins: ['TimePlugin'],
TimePlugin: {
format: 'HH:mm',
},
});
</script>
</body>
</html>
# Installation
# NPM
npm install @easepick/core @easepick/time-plugin
# CDN
<script src="https://cdn.jsdelivr.net/npm/@easepick/datetime@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/base-plugin@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/time-plugin@[version.number]/dist/index.umd.min.js"></script>
# Usage
If you’re using a bundler, e.g. webpack (opens new window):
import { easepick } from '@easepick/core';
import { TimePlugin } from '@easepick/time-plugin';
const picker = new easepick.create({
element: document.getElementById('datepicker'),
css: [
'https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.css',
'https://cdn.jsdelivr.net/npm/@easepick/time-plugin@[version.number]/dist/index.css',
],
plugins: [TimePlugin],
});
Another way to initialize easypick
:
const picker = new easepick.create({
element: document.getElementById('datepicker'),
css: [
'https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.css',
'https://cdn.jsdelivr.net/npm/@easepick/time-plugin@[version.number]/dist/index.css',
],
plugins: ['TimePlugin'],
});
# Options
Name | Type | Default | Description |
---|---|---|---|
seconds | boolean | false | Enable seconds picker. |
stepHours | number | 1 | Step for hours. |
stepMinutes | number | 5 | Step for minutes. |
stepSeconds | number | 5 | Step for seconds. |
format12 | boolean | false | Display 12H time. |
# Methods
Name | Description |
---|---|
setTime | Set a time for single date picker. |
setStartTime | Set start time of date range. |
setEndTime | Set end time of date range. |