third_party/closure/goog/i18n/dateintervalformat.js
function(
    pattern, opt_dateIntervalSymbols, opt_dateTimeSymbols) {
  asserts.assert(goog.isDef(pattern), 'Pattern must be defined.');
  asserts.assert(
      goog.isDef(opt_dateIntervalSymbols) ||
          goog.isDef(dateIntervalSymbols.getDateIntervalSymbols()),
      'goog.i18n.DateIntervalSymbols or explicit symbols must be defined');
  asserts.assert(
      goog.isDef(opt_dateTimeSymbols) || goog.isDef(DateTimeSymbols),
      'goog.i18n.DateTimeSymbols or explicit symbols must be defined');

  /**
   * DateIntervalSymbols object that contains locale data required by the
   * formatter.
   * @private @const {!dateIntervalSymbols.DateIntervalSymbols}
   */
  this.dateIntervalSymbols_ =
      opt_dateIntervalSymbols || dateIntervalSymbols.getDateIntervalSymbols();

  /**
   * DateTimeSymbols object that contain locale data required by the formatter.
   * @private @const {!DateTimeSymbolsType}
   */
  this.dateTimeSymbols_ = opt_dateTimeSymbols || DateTimeSymbols;

  /**
   * Date interval pattern to use.
   * @private @const {!dateIntervalSymbols.DateIntervalPatternMap}
   */
  this.intervalPattern_ = this.getIntervalPattern_(pattern);

  /**
   * Keys of the available date interval patterns. Used to lookup the key that
   * contains a specific pattern letter (e.g. for ['Myd', 'hms'], the key that
   * contains 'y' is 'Myd').
   * @private @const {!Array<string>}
   */
  this.intervalPatternKeys_ = object.getKeys(this.intervalPattern_);

  // Remove the default pattern's key ('_') from intervalPatternKeys_. Is not
  // necesary when looking up for a key: when no key is found it will always
  // default to the default pattern.
  array.remove(this.intervalPatternKeys_, DEFAULT_PATTERN_KEY_);

  /**
   * Default fallback pattern to use.
   * @private @const {string}
   */
  this.fallbackPattern_ =
      this.dateIntervalSymbols_.FALLBACK || DEFAULT_FALLBACK_PATTERN_;

  // Determine which date should be used with each part of the interval
  // pattern.
  var indexOfFirstDate = this.fallbackPattern_.indexOf(FIRST_DATE_PLACEHOLDER_);
  var indexOfSecondDate =
      this.fallbackPattern_.indexOf(SECOND_DATE_PLACEHOLDER_);
  if (indexOfFirstDate < 0 || indexOfSecondDate < 0) {
    throw new Error('Malformed fallback interval pattern');
  }

  /**
   * True if the first date provided should be formatted with the first pattern
   * of the interval pattern.
   * @private @const {boolean}
   */
  this.useFirstDateOnFirstPattern_ = indexOfFirstDate <= indexOfSecondDate;

  /**
   * Map that stores a Formatter_ object per calendar field. Formatters will be
   * instanced on demand and stored on this map until required again.
   * @private @const {!Object<string, !Formatter_>}
   */
  this.formatterMap_ = {};
}
function(
    pattern, opt_dateIntervalSymbols, opt_dateTimeSymbols) {
  asserts.assert(goog.isDef(pattern), 'Pattern must be defined.');
  asserts.assert(
      goog.isDef(opt_dateIntervalSymbols) ||
          goog.isDef(dateIntervalSymbols.getDateIntervalSymbols()),
      'goog.i18n.DateIntervalSymbols or explicit symbols must be defined');
  asserts.assert(
      goog.isDef(opt_dateTimeSymbols) || goog.isDef(DateTimeSymbols),
      'goog.i18n.DateTimeSymbols or explicit symbols must be defined');

  /**
   * DateIntervalSymbols object that contains locale data required by the
   * formatter.
   * @private @const {!dateIntervalSymbols.DateIntervalSymbols}
   */
  this.dateIntervalSymbols_ =
      opt_dateIntervalSymbols || dateIntervalSymbols.getDateIntervalSymbols();

  /**
   * DateTimeSymbols object that contain locale data required by the formatter.
   * @private @const {!DateTimeSymbolsType}
   */
  this.dateTimeSymbols_ = opt_dateTimeSymbols || DateTimeSymbols;

  /**
   * Date interval pattern to use.
   * @private @const {!dateIntervalSymbols.DateIntervalPatternMap}
   */
  this.intervalPattern_ = this.getIntervalPattern_(pattern);

  /**
   * Keys of the available date interval patterns. Used to lookup the key that
   * contains a specific pattern letter (e.g. for ['Myd', 'hms'], the key that
   * contains 'y' is 'Myd').
   * @private @const {!Array<string>}
   */
  this.intervalPatternKeys_ = object.getKeys(this.intervalPattern_);

  // Remove the default pattern's key ('_') from intervalPatternKeys_. Is not
  // necesary when looking up for a key: when no key is found it will always
  // default to the default pattern.
  array.remove(this.intervalPatternKeys_, DEFAULT_PATTERN_KEY_);

  /**
   * Default fallback pattern to use.
   * @private @const {string}
   */
  this.fallbackPattern_ =
      this.dateIntervalSymbols_.FALLBACK || DEFAULT_FALLBACK_PATTERN_;

  // Determine which date should be used with each part of the interval
  // pattern.
  var indexOfFirstDate = this.fallbackPattern_.indexOf(FIRST_DATE_PLACEHOLDER_);
  var indexOfSecondDate =
      this.fallbackPattern_.indexOf(SECOND_DATE_PLACEHOLDER_);
  if (indexOfFirstDate < 0 || indexOfSecondDate < 0) {
    throw new Error('Malformed fallback interval pattern');
  }

  /**
   * True if the first date provided should be formatted with the first pattern
   * of the interval pattern.
   * @private @const {boolean}
   */
  this.useFirstDateOnFirstPattern_ = indexOfFirstDate <= indexOfSecondDate;

  /**
   * Map that stores a Formatter_ object per calendar field. Formatters will be
   * instanced on demand and stored on this map until required again.
   * @private @const {!Object<string, !Formatter_>}
   */
  this.formatterMap_ = {};
}
function ( pattern , opt_dateIntervalSymbols , opt_dateTimeSymbols ) { asserts . assert ( goog . isDef ( pattern ) , 'Pattern must be defined.' ) ; asserts . assert ( goog . isDef ( opt_dateIntervalSymbols ) || goog . isDef ( dateIntervalSymbols . getDateIntervalSymbols ( ) ) , 'goog.i18n.DateIntervalSymbols or explicit symbols must be defined' ) ; asserts . assert ( goog . isDef ( opt_dateTimeSymbols ) || goog . isDef ( DateTimeSymbols ) , 'goog.i18n.DateTimeSymbols or explicit symbols must be defined' ) ; /**
   * DateIntervalSymbols object that contains locale data required by the
   * formatter.
   * @private @const {!dateIntervalSymbols.DateIntervalSymbols}
   */ this . dateIntervalSymbols_ = opt_dateIntervalSymbols || dateIntervalSymbols . getDateIntervalSymbols ( ) ; /**
   * DateTimeSymbols object that contain locale data required by the formatter.
   * @private @const {!DateTimeSymbolsType}
   */ this . dateTimeSymbols_ = opt_dateTimeSymbols || DateTimeSymbols ; /**
   * Date interval pattern to use.
   * @private @const {!dateIntervalSymbols.DateIntervalPatternMap}
   */ this . intervalPattern_ = this . getIntervalPattern_ ( pattern ) ; /**
   * Keys of the available date interval patterns. Used to lookup the key that
   * contains a specific pattern letter (e.g. for ['Myd', 'hms'], the key that
   * contains 'y' is 'Myd').
   * @private @const {!Array<string>}
   */ this . intervalPatternKeys_ = object . getKeys ( this . intervalPattern_ ) ; // Remove the default pattern's key ('_') from intervalPatternKeys_. Is not // necesary when looking up for a key: when no key is found it will always // default to the default pattern. array . remove ( this . intervalPatternKeys_ , DEFAULT_PATTERN_KEY_ ) ; /**
   * Default fallback pattern to use.
   * @private @const {string}
   */ this . fallbackPattern_ = this . dateIntervalSymbols_ . FALLBACK || DEFAULT_FALLBACK_PATTERN_ ; // Determine which date should be used with each part of the interval // pattern. var indexOfFirstDate = this . fallbackPattern_ . indexOf ( FIRST_DATE_PLACEHOLDER_ ) ; var indexOfSecondDate = this . fallbackPattern_ . indexOf ( SECOND_DATE_PLACEHOLDER_ ) ; if ( indexOfFirstDate < 0 || indexOfSecondDate < 0 ) { throw new Error ( 'Malformed fallback interval pattern' ) ; } /**
   * True if the first date provided should be formatted with the first pattern
   * of the interval pattern.
   * @private @const {boolean}
   */ this . useFirstDateOnFirstPattern_ = indexOfFirstDate <= indexOfSecondDate ; /**
   * Map that stores a Formatter_ object per calendar field. Formatters will be
   * instanced on demand and stored on this map until required again.
   * @private @const {!Object<string, !Formatter_>}
   */ this . formatterMap_ = { } ; }
Constructs a DateIntervalFormat object based on the current locale.

@param {number|!dateIntervalSymbols.DateIntervalPatternMap} pattern Pattern
specification or pattern object.
@param {!dateIntervalSymbols.DateIntervalSymbols=} opt_dateIntervalSymbols
Optional DateIntervalSymbols to use for this instance rather than the
global symbols.
@param {!DateTimeSymbolsType=} opt_dateTimeSymbols Optional DateTimeSymbols
to use for this instance rather than the global symbols.
@constructor
@struct
@final
Constructs a DateIntervalFormat object based on the current locale .