Code to build calendar through initCalendar