LocalizationService lclService = Aura.getLocalizationService();
if (format == null) {
String dateStyle = (String) component.getAttributes().getValue("dateStyle");
String timeStyle = (String) component.getAttributes().getValue("timeStyle");
DateService dateService = DateServiceImpl.get();
int intDateStyle = dateService.getStyle(dateStyle);
int intTimeStyle = dateService.getStyle(timeStyle);
return lclService.formatDateTime(cal.getTime(), loc, tz, intDateStyle, intTimeStyle);
} else {
// no pattern, no result
if (AuraTextUtil.isEmptyOrWhitespace(format)) {
return "";