Skip to content

Instantly share code, notes, and snippets.

@rblalock
Created October 26, 2010 04:48
Show Gist options
  • Save rblalock/646338 to your computer and use it in GitHub Desktop.
Save rblalock/646338 to your computer and use it in GitHub Desktop.
Date / time picker for Titanium
// Label
var label = Ti.UI.createLabel({
text: 'Due Date',
top: 10,
left: 10,
height: 30,
color: '#333',
font: { fontWeight: 'bold', fontSize: 20 },
shadowColor:'#eee',
shadowOffset:{x: 0, y: 1}
});
// Set picker data
var minDate = new Date();
minDate.setFullYear(2010);
minDate.setMonth(0);
minDate.setDate(1);
var maxDate = new Date();
maxDate.setFullYear(2010);
maxDate.setMonth(11);
maxDate.setDate(31);
var value = new Date();
value.setFullYear(2010);
value.setMonth(0);
value.setDate(1);
var picker = Ti.UI.createPicker({
type: Ti.UI.PICKER_TYPE_DATE_AND_TIME,
bottom: 0
});
// turn on the selection indicator (off by default)
picker.selectionIndicator = true;
// picker.addEventListener('change',function(e)
// {
// label.text = e.value;
// });
win.add(label);
win.add(picker);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment