The TiSQ project allows you to use Square's open source TimeSquare calendar picker in your Titanium app.
Download the platform you wish to use:
If you are building from source you will need to do the following:
Import the project into Xcode:
Import the project into Eclipse:
var square = require('ti.sq');
The Ti.SQ view supports a majority of the standard Ti.UI.View properties. The below listed properties are specific to the Ti.SQ calendar view.
Parameters
value : Dictionary
The selection value on the Ti.SQ calendar View
min : Dictionary
The minimum date that will be shown and allowed to be selected on the Ti.SQ calendar view.
max : Dictionary
The maximum date that will be shown and allowed to be selected on the Ti.SQ calendar view.
PagingEnabled : Boolean
Enabled by default, this property determines if the Ti.SQ calendar view allows for scrolling
BackgroundColor : String/Color
The color of the calendar view month headings
Additional Properties
dateValue : Date
Once the Calendar View has been created and added to your Ti.UI.Window, the dateValue property can be used to obtain a JavaScript date object with the selected date of the Calendar View.
Example
//Require the square module into your project
var square = require('ti.sq');
var calendarView = square.createView({
height:Ti.UI.FILL,
width:Ti.UI.FILL,
pagingEnabled:true,
value:{
month:4,day:15,year:2013
},
min:{
month:2,day:15,year:2013
},
max:{
month:10,day:15,year:2013
}
});
dateChanged
This event is called when a date is selected by the user.
Callback Property Values
dateValue : Date
A JavaScript date object with the selected date of the Calendar View
value : Dictionary
A dictionary object with the day, month, and year of the selected date of the Calendar View.
For exampe:
{
month:4,day:15,year:2013
}
Example
calendarView.addEventListener('dateChanged',function(d){
Ti.API.info(JSON.stringify(d));
Ti.API.info(JSON.stringify(d.dateValue));
Ti.API.info(JSON.stringify(d.value));
Ti.API.info(JSON.stringify(calendarView.value));
});
Please check the module's example folder or
for samples on how to use this project.
Please consider following the @benCoding Twitter for updates and more about Titanium.
For module updates, Titanium tutorials and more please check out my blog at benCoding.Com.