logo

/Time Picker|v2.1.6

Class

new TimePicker(container, options)index.jsline 100

PARAMETERS
NameTypeDescription

container

stringHTMLElement

Container element or selector

options

[ Object ]

Options for initialization

PROPERTIES
NameTypeDescription

initialHour

number = 0

Initial setting value of hour

initialMinute

number = 0

Initial setting value of minute

hourStep

number = 1

Step value of hour

minuteStep

number = 1

Step value of minute

inputType

string = 'selectbox'

'selectbox' or 'spinbox'

format

string = 'h:m'

hour, minute format for display

showMeridiem

boolean = true

Show meridiem expression?

disabledHours

Array = []

Registered Hours is disabled.

disabledMinutes

Object = {}

Registered Minutes of selected hours is disabled.

PROPERTIES
NameTypeDescription

hour

[ Object ]

Key must be hour(number).
Value is array which contains only true or false and must be 60 of length

meridiemPosition

string = 'right'

Set location of the meridiem element.
If this option set 'left', the meridiem element is created in front of the hour element.

language

string = 'en'

Set locale texts

usageStatistics

Boolean = true|false

send hostname to google analytics default value is true

EXAMPLES
// ES6
import TimePicker from 'tui-time-picker';

// CommonJS
const TimePicker = require('tui-time-picker');

// Browser
const TimePicker = tui.TimePicker;

const timepicker = new TimePicker('#timepicker-container', {
    initialHour: 15,
    initialMinute: 13,
    inputType: 'selectbox',
    showMeridiem: false
});

Static Properties

localeTexts:

object

index.jsline 118

Locale text data

EXAMPLES
TimePicker.localeTexts['customKey'] = {
    am: 'a.m.',
    pm: 'p.m.'
};

const instance = new TimePicker('#timepicker-container', {
    language: 'customKey',
});

Instance Methods

changeLanguage(language)index.jsline 913

Change locale text of meridiem by language code

PARAMETERS
NameTypeDescription

language

string

Language code

destroy()index.jsline 921

Destroy

getHour()index.jsline 897

Get hour

RETURNS:
{

number

} - hour - (0~23)

getHourStep()index.jsline 572

Get step of hour

RETURNS:
{

number

} - Step of hour

getMinute()index.jsline 905

Get minute

RETURNS:
{

number

} - minute

getMinuteStep()index.jsline 589

Get step of minute

RETURNS:
{

number

} - Step of minute

hide()index.jsline 603

Hide time picker element

resetMinuteRange()index.jsline 801

Reset minute selectable range

setHour(hour)index.jsline 612

Set hour

PARAMETERS
NameTypeDescription

hour

number

for time picker - (0~23)

RETURNS:
{

boolean

} - result of set time

setHourStep(step)index.jsline 563

Set step of hour

PARAMETERS
NameTypeDescription

step

array

Step to create items of hour

setMinute(minute)index.jsline 621

Set minute

PARAMETERS
NameTypeDescription

minute

number

for time picker

RETURNS:
{

boolean

} - result of set time

setMinuteStep(step)index.jsline 580

Set step of minute

PARAMETERS
NameTypeDescription

step

number

Step to create items of minute

setRange(begin, end)index.jsline 672

Set selectable range

PARAMETERS
NameTypeDescription

begin

Object

Contain begin hour and minute of range

PROPERTIES
NameTypeDescription

hour

number

begin hour of range

minute

number

begin minute of range

end

[ Object ]

Contain end hour and minute of range

PROPERTIES
NameTypeDescription

hour

number

end hour of range

minute

number

end minute of range

setTime(hour, minute, silent)index.jsline 631

Set time

PARAMETERS
NameTypeDescription

hour

number

for time picker - (0~23)

minute

number

for time picker

silent

[ boolean ]

if it set true, 'change' event will not be fired.

show()index.jsline 596

Show time picker element

Events

changeindex.jsline 655

Change event - TimePicker

PROPERTIES
NameTypeDescription

hour

number

changed hour

minute

number

changed minute

EXAMPLES
timepicker.on('change', (e) => {
  console.log(e.hour, e.minute);
});
Resizable