public static String convertToGDay(Object jsObject) throws AxisFault {
try {
// If the user returned a valid GDay a s a String we use the converterUtil to
// validate it and return it back.
if (jsObject instanceof String) {
Day day = ConverterUtil.convertToGDay((String)jsObject);
return ConverterUtil.convertToString(day);
}
Date date = (Date) Context.jsToJava(jsObject, Date.class);
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.setTime(date);
Day day = new Day(calendar.get(Calendar.DAY_OF_MONTH));
return ConverterUtil.convertToString(day);
} catch (EvaluatorException e) {
throw new AxisFault("Unable to convert the return value to day");
} catch (NumberFormatException e) {
throw new AxisFault("Unable to convert the return value to day");