0.5.0 • Published 12 months ago

stimulus-easepick v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

Stimulus Easepick Datepicker

npm version

Getting started

Experience the power of simplicity with our lightweight, zero-dependency datepicker powered by easepick. This Stimulus controller wrapper brings you:

  • Seamless integration with Stimulus
  • Minimal footprint for optimal performance
  • Rich functionality without the bloat

Transform date input fields into intuitive, user-friendly datepickers with minimal effort.

Installation

Ensure you have the following dependencies installed in your project:

  • @hotwired/stimulus v3 or later
  • @easepick/bundle v1.2 or later

Integrate stimulus-easepick into your project:

npm install stimulus-easepick
# yarn add stimulus-easepick

Register the datepicker controller with your Stimulus application:

// app/javascript/controllers/index.js
import { Application } from "@hotwired/stimulus";
import Datepicker from "stimulus-easepick";

const application = Application.start();
application.register("datepicker", Datepicker);

Usage

<div data-controller="datepicker" data-datepicker-format-value="D MMM YYYY">
  <input data-datepicker-target="input" />
</div>

Configuration

AttributeDefaultTypeDescription
data-datepicker-first-day-value1NumberDay of start week. (0 - Sunday, 1 - Monday, etc…)
data-datepicker-lang-valueen-USStringLanguage. This option affect to day names, month names via Date.prototype.toLocaleString() and also affect to plural rules via Intl.PluralRules.
data-datepicker-date-valueString, NumberUnix Timestamp (with milliseconds) or String (must satisfy the option format).
data-datepicker-format-valueYYYY-MM-DDStringThe default output format. See tokens format.
data-datepicker-grid-value1NumberNumber of calendar columns.
data-datepicker-calendars-value1NumberNumber of visible months.
data-datepicker-readonly-valuefalseBooleanAdd readonly attribute to element.
data-datepicker-inline-valuefalseBooleanShow calendar inline.
data-datepicker-lock-min-date-valueString, NumberLock Plugin. The minimum date that can be selected. Unix Timestamp (with milliseconds) or String (must satisfy the option format).
data-datepicker-lock-max-date-valueString, NumberLock Plugin. The maximum date that can be selected. Unix Timestamp (with milliseconds) or String (must satisfy the option format).
data-datepicker-enable-time-valuefalseBooleanEnable Time Plugin.
data-datepicker-time-seconds-valuefalseBooleanEnable seconds picker.
data-datepicker-time-step-hours-value1NumberStep for hours.
data-datepicker-time-step-minutes-value5NumberStep for minutes.
data-datepicker-time-step-seconds-value5NumberStep for seconds.
data-datepicker-time-twelve-format-valuefalseBooleanDisplay 12H time.
data-datepicker-enable-amp-valuefalseBooleanEnable Amp Plugin.
data-datepicker-amp-reset-button-valuefalseBooleanAdds a reset button to clear the current selection.
data-datepicker-amp-months-valuefalseBooleanEnable the months dropdown in the calendar.
data-datepicker-amp-years-valuefalseBooleanEnable the years dropdown in the calendar.
data-datepicker-amp-min-year-value1950NumberThe minimum year that can be selected in the dropdown.
data-datepicker-amp-max-year-valuenullNumberThe maximum year that can be selected in the dropdown.
data-datepicker-enable-range-valuefalseBooleanEnable Range Plugin.
data-datepicker-range-delimiter-value-StringDelimiter between dates.
data-datepicker-range-tooltip-valuetrueBooleanShowing tooltip with how many days will be selected.
data-datepicker-range-start-date-valuenullString, NumberPreselect start date. Unix Timestamp (with milliseconds) or String (must satisfy the option format).
data-datepicker-range-end-date-valuenullString, NumberPreselect end date. Unix Timestamp (with milliseconds) or String (must satisfy the option format).
data-datepicker-enable-preset-valuefalseBooleanEnable Preset Plugin. Range plugin must be enabled.
data-datepicker-preset-position-valueleftStringPosition of preset block (left, right, top, or bottom).

Contributing

Do not hesitate to contribute to the project by adapting or adding features! Bug reports or pull requests are welcome.

Don't forget to drop a 🌟 on GitHub to support the project.

License

This project is released under the MIT license.

0.5.0

12 months ago

0.4.0

12 months ago

0.3.0

12 months ago

0.2.0

12 months ago

0.1.1

12 months ago

0.1.0

12 months ago