Skip to content

Repository files navigation

Timepicker

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

Install

npm i @andreazorzi/timepicker

Usage

app.js

// TimepickerimportTimepickerfrom"@andreazorzi/timepicker";window.Timepicker=Timepicker;// Localesimporttimepicker_itfrom"@andreazorzi/timepicker/locale/it";window.timepicker_it=timepicker_it;

app.css

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

HTML

<divclass="timepicker"><inputtype="text" id="time" name="time"></div><script>lettime=newTimepicker("#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 modalopen()// Close the modalclose()// Get the current hour valuegetHour()// Get the current minute valuegetMinute()// Get the current am /pm selector valuegetAmPm()// Get current formatted time valuegetFormattedTime()

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages