String clientId = calendar.getClientId(context);
Locale locale = calendar.calculateLocale(context);
String pattern = calendar.isTimeOnly() ? calendar.calculateTimeOnlyPattern() : calendar.calculatePattern();
String mask = calendar.getMask();
WidgetBuilder wb = getWidgetBuilder(context);
wb.initWithDomReady("Calendar", calendar.resolveWidgetVar(), clientId);
wb.attr("popup", calendar.isPopup())
.attr("locale", locale.toString())
.attr("dateFormat", CalendarUtils.convertPattern(pattern));