Returns a String value representing the result of calling ToNumber(date)
according to the effective locale and the formatting options of this
DateTimeFormat.
function formatDate(formatter, dateValue) {
  var dateMs;
  if (IS_UNDEFINED(dateValue)) {
    dateMs = %DateCurrentTime();
  } else {
    dateMs = TO_NUMBER(dateValue);
  }

  if (!NUMBER_IS_FINITE(dateMs)) throw MakeRangeError(kDateRange);

  return %InternalDateFormat(%GetImplFromInitializedIntlObject(formatter),
                             new GlobalDate(dateMs));
}