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