logo

/Time Picker|v2.1.4

Class

new TimePicker(container, options)index.jsline 105

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 123

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 905

Change locale text of meridiem by language code

PARAMETERS
NameTypeDescription

language

string

Language code

destroy()index.jsline 913

Destroy

getHour()index.jsline 889

Get hour

RETURNS:
{

number

} - hour - (0~23)

getHourStep()index.jsline 592

Get step of hour

RETURNS:
{

number

} - Step of hour

getMinute()index.jsline 897

Get minute

RETURNS:
{

number

} - minute

getMinuteStep()index.jsline 609

Get step of minute

RETURNS:
{

number

} - Step of minute

hide()index.jsline 623

Hide time picker element

resetMinuteRange()index.jsline 795

Reset minute selectable range

setHour(hour)index.jsline 632

Set hour

PARAMETERS
NameTypeDescription

hour

number

for time picker - (0~23)

RETURNS:
{

boolean

} - result of set time

setHourStep(step)index.jsline 583

Set step of hour

PARAMETERS
NameTypeDescription

step

array

Step to create items of hour

setMinute(minute)index.jsline 641

Set minute

PARAMETERS
NameTypeDescription

minute

number

for time picker

RETURNS:
{

boolean

} - result of set time

setMinuteStep(step)index.jsline 600

Set step of minute

PARAMETERS
NameTypeDescription

step

array

Step to create items of minute

setRange(begin, end)index.jsline 689

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)index.jsline 650

Set time

PARAMETERS
NameTypeDescription

hour

number

for time picker - (0~23)

minute

number

for time picker

show()index.jsline 616

Show time picker element

Events

changeindex.jsline 674

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