1.0.11 • Published 2 months ago

@andreazorzi/timepicker v1.0.11

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

Timepicker

Lightweight timepicker selector plugin, useful to avoid ugly default browser timepicker.

Install

npm i @andreazorzi/timepicker

Usage

app.js

// Timepicker
import Timepicker from "@andreazorzi/timepicker";
window.Timepicker = Timepicker;

// Locales
import timepicker_it from "@andreazorzi/timepicker/locale/it";
window.timepicker_it = timepicker_it;

app.css

@import "@andreazorzi/timepicker/timepicker.css";

HTML

<div class="timepicker">
    <input type="text" id="time" name="time">
</div>

<script>
    let time = new Timepicker("#time", options)
</script>

Options List

{
    disabled: true, // set the field to readonly
	selected:{
	    hour: -1,  // sets hours and minutes default value,
	    minute: -1 // if the value is -1, the field value will be empty
	}
    lang: default_lang, // an array of translated texts, default locale: it
	am_pm: false // set AM / PM mode
}

Methods

// Open the modal
open()

// Close the modal
close()

// Get the current hour value
getHour()

// Get the current minute value
getMinute()

// Get the current am /pm selector value
getAmPm()

// Get current formatted time value
getFormattedTime()
1.0.11

2 months ago

1.0.10

5 months ago

1.0.9

6 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago