code: public static String toJson(Calendar cal) {
          if (cal == null) {
              return NULL_VALUE;
          }
  
          CharBuf buffer = CharBuf.create(26);
          writeDate(cal.getTime(), buffer);
  
          return buffer.toString();
      }
docs: Format a calendar instance that is parseable from JavaScript, according to ISO-8601.
  
  @param cal the calendar to format to a JSON string
  @return a formatted date in the form of a string