Skip to content

@gothassos/easepick-preset-plugin ​

npm version

TIP

This package does not need to be installed if you are using @gothassos/easepick-bundle.

Adds predefined ranges.

Required: ​

Quick example ​

html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>easepick</title>
    <script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-datetime@1.5.0/dist/index.umd.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-core@1.5.0/dist/index.umd.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-base-plugin@1.5.0/dist/index.umd.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-range-plugin@1.5.0/dist/index.umd.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-preset-plugin@1.5.0/dist/index.umd.js"></script>
  </head>
  <body>
    <input id="datepicker"/>
    <script>
      const picker = new easepick.create({
        element: document.getElementById('datepicker'),
        css: [
          'https://cdn.jsdelivr.net/npm/@gothassos/easepick-core@1.5.0/dist/index.css',
          'https://cdn.jsdelivr.net/npm/@gothassos/easepick-range-plugin@1.5.0/dist/index.css',
          'https://cdn.jsdelivr.net/npm/@gothassos/easepick-preset-plugin@1.5.0/dist/index.css',
        ],
        plugins: ['RangePlugin', 'PresetPlugin'],
        PresetPlugin: {
          position: 'left',
        },
      });
    </script>
  </body>
</html>

Installation ​

NPM ​

bash
npm install @gothassos/easepick-core @gothassos/easepick-preset-plugin

CDN ​

html
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-datetime@1.5.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-core@1.5.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-base-plugin@1.5.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-range-plugin@1.5.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-preset-plugin@1.5.0/dist/index.umd.js"></script>

Usage ​

If you’re using a bundler, e.g. webpack:

ts
import { easepick } from '@gothassos/easepick-core';
import { RangePlugin } from '@gothassos/easepick-range-plugin';
import { PresetPlugin } from '@gothassos/easepick-preset-plugin';

const picker = new easepick.create({
  element: document.getElementById('datepicker'),
  css: [
    'https://cdn.jsdelivr.net/npm/@gothassos/easepick-core@1.5.0/dist/index.css',
    'https://cdn.jsdelivr.net/npm/@gothassos/easepick-range-plugin@1.5.0/dist/index.css',
    'https://cdn.jsdelivr.net/npm/@gothassos/easepick-preset-plugin@1.5.0/dist/index.css',
  ],
  plugins: [RangePlugin, PresetPlugin],
});

Another way to initialize easypick:

js
const picker = new easepick.create({
  element: document.getElementById('datepicker'),
  css: [
    'https://cdn.jsdelivr.net/npm/@gothassos/easepick-core@1.5.0/dist/index.css',
    'https://cdn.jsdelivr.net/npm/@gothassos/easepick-range-plugin@1.5.0/dist/index.css',
    'https://cdn.jsdelivr.net/npm/@gothassos/easepick-preset-plugin@1.5.0/dist/index.css',
  ],
  plugins: ['RangePlugin', 'PresetPlugin'],
});

Options ​

NameTypeDefaultDescription
customPresetobjectnullDefine your own ranges.
customLabels['Today', 'Yesterday',
'Last 7 Days', 'Last 30 Days',
'This Month', 'Last Month']
nullDefine your own labels.
positionstring'left'Position of preset block.