add:   this.ampmIndex = null;                var digitsExpr = "(\\d?\\d)(\\D)?(?:(\\d\\d)(\\D)?(?:(\\d\\d)(\\D)?)?)?";  var anyAmPmExpr = "(?:[^\\d\\W]|[. ])+";  var probeTimeRegExp = new RegExp("^("+anyAmPmExpr+")?\\s?"+digitsExpr+"("+anyAmPmExpr+")?\\s*$"); const PRE_INDEX=1, HR_INDEX=2, MIN_INDEX=4, SEC_INDEX=6, POST_INDEX=8;  var amProbeTime = new Date(2000,0,1,6,12,34); var amProbeString = this.getFormatedTime(amProbeTime); var pmProbeTime = new Date(2000,0,1,18,12,34); var pmProbeString = this.getFormatedTime(pmProbeTime); var amFormatExpr = null, pmFormatExpr = null; if (amProbeString != pmProbeString) { var amProbeArray = probeTimeRegExp.exec(amProbeString); var pmProbeArray = probeTimeRegExp.exec(pmProbeString); if (amProbeArray != null && pmProbeArray != null) { if (amProbeArray[PRE_INDEX] && pmProbeArray[PRE_INDEX] && amProbeArray[PRE_INDEX] != pmProbeArray[PRE_INDEX]) { this.ampmIndex = PRE_INDEX; } else if (amProbeArray[POST_INDEX] && pmProbeArray[POST_INDEX]) { if (amProbeArray[POST_INDEX] != pmProbeArray[POST_INDEX]) { this.ampmIndex = POST_INDEX; } else {    for (var k = SEC_INDEX; k >= HR_INDEX; k -= 2) { var nextSepI = k + 1; var nextDigitsI = k + 2; if ((k == SEC_INDEX || (!amProbeArray[nextDigitsI] && !pmProbeArray[nextDigitsI])) && amProbeArray[nextSepI] && pmProbeArray[nextSepI] && amProbeArray[nextSepI] != pmProbeArray[nextSepI]) { amProbeArray[POST_INDEX] = amProbeArray[nextSepI] + amProbeArray[POST_INDEX]; pmProbeArray[POST_INDEX] = pmProbeArray[nextSepI] + pmProbeArray[POST_INDEX]; this.ampmIndex = POST_INDEX; break; } } } } if (this.ampmIndex) { var makeFormatRegExp = function(string) {  var regExp = string.replace(/(\W)/g, "[$1]"); var lowercased = string.toLowerCase(); if (string != lowercased) regExp += "|"+lowercased; var uppercased = string.toUpperCase(); if (string != uppercased) regExp += "|"+uppercased; return regExp; };  amFormatExpr = makeFormatRegExp(amProbeArray[this.ampmIndex]); pmFormatExpr = makeFormatRegExp(pmProbeArray[this.ampmIndex]); } } }  var amExpr = "[Aa\u0410\u0430][. ]?[Mm\u041c\u043c][. ]?|\u4e0a\u5348|\u5348\u524d"; var pmExpr = "[Pp\u0420\u0440][. ]?[Mm\u041c\u043c][. ]?|\u4e0b\u5348|\u5348\u5f8c"; if (this.ampmIndex){ amExpr = amFormatExpr+"|"+amExpr; pmExpr = pmFormatExpr+"|"+pmExpr; } var ampmExpr = amExpr+"|"+pmExpr;          this.parseTimeRegExp = new RegExp("("+ampmExpr+")?\\s?"+digitsExpr+"("+ampmExpr+")?\\s*$"); this.amRegExp = new RegExp("^(?:"+amExpr+")$"); this.pmRegExp = new RegExp("^(?:"+pmExpr+")$"); 
context: function DateFormater( ){  // we get the date bundle in case the locale changes, can  // we be notified of a locale change instead, then we could  // get the bundle once.  this.dateStringBundle = srGetStrBundle("chrome://calendar/locale/dateFormat.properties");  // probe the dateformat    this.yearIndex = -1;  this.monthIndex = -1;  this.dayIndex = -1;  this.twoDigitYear = false;  this.alphaMonths = null;  this.probeSucceeded = false;  // SHORT NUMERIC DATE, such as 2002-03-04, 4/3/2002, or CE2002Y03M04D.  // Made of digits & nonDigits.  (Nondigits may be unicode letters  // which do not match \w, esp. in CJK locales.)  var parseShortDateRegex = /^\D*(\d+)\D+(\d+)\D+(\d+)\D?$/;  var probeDate = new Date(2002,3-1,4); // month is 0-based  var probeString = this.getShortFormatedDate(probeDate);  var probeArray = parseShortDateRegex.exec(probeString);  if (probeArray != null) {     // Numeric month format    for (var i = 1; i <= 3; i++) {       switch (Number(probeArray[i])) {        case 02:    this.twoDigitYear = true; // fall thru        case 2002:  this.yearIndex = i;       break;        case 3:     this.monthIndex = i;      break;        case 4:     this.dayIndex = i;        break;      }    }    //All three indexes are set (not -1) at this point.    this.probeSucceeded = true;  } else {    // SHORT DATE WITH ALPHABETIC MONTH, such as "dd MMM yy" or "MMMM dd, yyyy"    // (\d+|[^\d\W]) is digits or letters, not both together.    // Allows 31dec1999 (no delimiters between parts) if OS does (w2k does not).    // Allows Dec 31, 1999 (comma and space between parts)    // (Only accepts ASCII month names; JavaScript RegExp does not have an    // easy way to describe unicode letters short of a HUGE character range    // regexp derived from the Alphabetic ranges in     // http://www.unicode.org/Public/UNIDATA/DerivedCoreProperties.txt)    parseShortDateRegex = /^\s*(\d+|[^\d\W]+)\W{0,2}(\d+|[^\d\W]+)\W{0,2}(\d+|[^\d\W]+)\s*$/;    probeArray = parseShortDateRegex.exec(probeString);    if (probeArray != null) {      for (var j = 1; j <= 3; j++) {         switch (Number(probeArray[j])) {          case 02:    this.twoDigitYear = true; // fall thru          case 2002:  this.yearIndex = j;       break;          case 4:     this.dayIndex = j;        break;          default:    this.monthIndex = j;      break;        }      }      if (this.yearIndex != -1 && this.dayIndex != -1 && this.monthIndex != -1) {        this.probeSucceeded = true;        // Fill this.alphaMonths with month names.        this.alphaMonths = new Array(12);        for (var m = 0; m < 12; m++) {          probeDate.setMonth(m);          probeString = this.getShortFormatedDate(probeDate);          probeArray = parseShortDateRegex.exec(probeString);          if (probeArray != null)             this.alphaMonths[m] = probeArray[this.monthIndex].toUpperCase();          else            this.probeSucceeded = false;        }      }    }    if (! this.probeSucceeded)      dump("\nOperating system short date format is not recognized: "+probeString+"\n");  }  // If LONG FORMATTED DATE is same as short formatted date,  // then OS has poor extended/long date config, so use workaround.  this.useLongDateService = true;  try {     var longProbeString = this.getLongFormatedDate(probeDate);    // On Unix extended/long date format may be created using %Ex instead of %x.    // Some systems may not support it and return "Ex" or same as short string.    // In that case, don't use long date service, use workaround hack instead.    if (longProbeString == null || longProbeString.length < 4 || longProbeString == probeString)      this.useLongDateService = false;  } catch (error) {    this.useLongDateService = false;  }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/f516d2ea36b83160278cbb9badcae0c88a8d6ffd/dateUtils.js/buggy/calendar/resources/content/dateUtils.js