Use the following code to create a basic inputEx TimeIntervalField.
var field = new Y.inputEx.TimeIntervalField({parentEl: 'container1', label: 'Length',value:82800});
var button = inputEx.cn('button', null, null, 'getValue');
Y.one(button).on('click',function() {
alert(field.getValue()+" (seconds)");
});
Y.one('#container1').appendChild(button);
You can set the fields and separators options of the combine field to customize the field
var units = inputEx.TimeIntervalField.units;
var unitsStr = inputEx.messages.timeUnits;
var n=[]; for(var i=1;i !=30;i++){ n.push(i); }
var fields = [
{type: 'select', choices: n },
{
type: 'select',
choices: [
{ value: units.DAY, label: unitsStr.DAY },
{ value: units.MONTH, label: unitsStr.MONTH },
{ value: units.YEAR, label: unitsStr.YEAR }
]
}
];
new Y.inputEx.TimeIntervalField({
parentEl: 'container2',
value: 60*24*2, // 2 days
unit: inputEx.TimeIntervalField.units.MINUTE,
label: 'Continue',
fields: fields,
separators: ["for ", " ", false]
});