return pattern.replace(/([a-z])\1*/ig, function(match){ var s; var c = match.charAt(0); var l = match.length; var pad; var widthList = ["abbr", "wide", "narrow"]; switch(c){ case 'G': if(l>3){dojo.unimplemented("Era format not implemented");} s = info.eras[dateObject.getFullYear() < 0 ? 1 : 0]; break; case 'y': s = dateObject.getFullYear(); switch(l){ case 1: break; case 2: s = String(s).substr(-2); break; default: pad = true; } break; case 'Q': case 'q': s = Math.ceil((dateObject.getMonth()+1)/3); switch(l){ case 1: case 2: pad = true; break; case 3: case 4: dojo.unimplemented("Quarter format not implemented"); } break; case 'M': case 'L': var m = dateObject.getMonth(); var width; switch(l){ case 1: case 2: s = m+1; pad = true; break; case 3: case 4: case 5: width = widthList[l-3]; break; } if(width){ var type = (c == "L") ? "standalone" : "format"; var prop = ["months",type,width].join("-"); s = info[prop][m]; } break; case 'w': var firstDay = 0; s = dojo.date.getWeekOfYear(dateObject, firstDay); pad = true; break; case 'd': s = dateObject.getDate(); pad = true; break; case 'D': s = dojo.date.getDayOfYear(dateObject); pad = true; break; case 'E': case 'e': case 'c': var d = dateObject.getDay(); var width; switch(l){ case 1: case 2: if(c == 'e'){ var first = dojo.date.getFirstDayOfWeek(options.locale); d = (d-first+7)%7; } if(c != 'c'){ s = d+1; pad = true; break; }  case 3: case 4: case 5: width = widthList[l-3]; break; } if(width){ var type = (c == "c") ? "standalone" : "format"; var prop = ["days",type,width].join("-"); s = info[prop][d]; } break; case 'a': var timePeriod = (dateObject.getHours() < 12) ? 'am' : 'pm'; s = info[timePeriod]; break; case 'h': case 'H': case 'K': case 'k': var h = dateObject.getHours();  switch (c) { case 'h': s = (h % 12) || 12; break; case 'H': s = h; break; case 'K': s = (h % 12); break; case 'k': s = h || 24; break; } pad = true; break; case 'm': s = dateObject.getMinutes(); pad = true; break; case 's': s = dateObject.getSeconds(); pad = true; break; case 'S': s = Math.round(dateObject.getMilliseconds() * Math.pow(10, l-3)); break; case 'v': case 'z':  s = dojo.date.getTimezoneName(dateObject); if(s){break;} l=4;  case 'Z': var offset = dateObject.getTimezoneOffset(); var tz = [ (offset<=0 ? "+" : "-"), dojo.string.pad(Math.floor(Math.abs(offset)/60), 2), dojo.string.pad(Math.abs(offset)% 60, 2) ]; if(l==4){ tz.splice(0, 0, "GMT"); tz.splice(3, 0, ":"); } s = tz.join(""); break; case 'Y': case 'u': case 'W': case 'F': case 'g': case 'A': dojo.debug(match+" modifier not yet implemented"); s = "?"; break; default: dojo.raise("dojo.date.format: invalid pattern char: "+pattern); } if(pad){ s = dojo.string.pad(s, l); } return s; }); } 
return pattern.replace(/([a-z])\1*/ig, function(match){ var s; var c = match.charAt(0); var l = match.length; var pad; var widthList = ["abbr", "wide", "narrow"]; switch(c){ case 'G': if(l>3){dojo.unimplemented("Era format not implemented");} s = info.eras[dateObject.getFullYear() < 0 ? 1 : 0]; break; case 'y': s = dateObject.getFullYear(); switch(l){ case 1: break; case 2: s = String(s).substr(-2); break; default: pad = true; } break; case 'Q': case 'q': s = Math.ceil((dateObject.getMonth()+1)/3); switch(l){ case 1: case 2: pad = true; break; case 3: case 4: dojo.unimplemented("Quarter format not implemented"); } break; case 'M': case 'L': var m = dateObject.getMonth(); var width; switch(l){ case 1: case 2: s = m+1; pad = true; break; case 3: case 4: case 5: width = widthList[l-3]; break; } if(width){ var type = (c == "L") ? "standalone" : "format"; var prop = ["months",type,width].join("-"); s = info[prop][m]; } break; case 'w': var firstDay = 0; s = dojo.date.getWeekOfYear(dateObject, firstDay); pad = true; break; case 'd': s = dateObject.getDate(); pad = true; break; case 'D': s = dojo.date.getDayOfYear(dateObject); pad = true; break; case 'E': case 'e': case 'c': var d = dateObject.getDay(); var width; switch(l){ case 1: case 2: if(c == 'e'){ var first = dojo.date.getFirstDayOfWeek(options.locale); d = (d-first+7)%7; } if(c != 'c'){ s = d+1; pad = true; break; }  case 3: case 4: case 5: width = widthList[l-3]; break; } if(width){ var type = (c == "c") ? "standalone" : "format"; var prop = ["days",type,width].join("-"); s = info[prop][d]; } break; case 'a': var timePeriod = (dateObject.getHours() < 12) ? 'am' : 'pm'; s = info[timePeriod]; break; case 'h': case 'H': case 'K': case 'k': var h = dateObject.getHours();  switch (c) { case 'h': s = (h % 12) || 12; break; case 'H': s = h; break; case 'K': s = (h % 12); break; case 'k': s = h || 24; break; } pad = true; break; case 'm': s = dateObject.getMinutes(); pad = true; break; case 's': s = dateObject.getSeconds(); pad = true; break; case 'S': s = Math.round(dateObject.getMilliseconds() * Math.pow(10, l-3)); break; case 'v': case 'z':  s = dojo.date.getTimezoneName(dateObject); if(s){break;} l=4;  case 'Z': var offset = dateObject.getTimezoneOffset(); var tz = [ (offset<=0 ? "+" : "-"), dojo.string.pad(Math.floor(Math.abs(offset)/60), 2), dojo.string.pad(Math.abs(offset)% 60, 2) ]; if(l==4){ tz.splice(0, 0, "GMT"); tz.splice(3, 0, ":"); } s = tz.join(""); break; case 'Y': case 'u': case 'W': case 'F': case 'g': case 'A': dojo.debug(match+" modifier not yet implemented"); s = "?"; break; default: dojo.raise("dojo.date.format: invalid pattern char: "+pattern); } if(pad){ s = dojo.string.pad(s, l); } return s; }); } 
	function formatPattern(dateObject, pattern){		return pattern.replace(/([a-z])\1*/ig, function(match){			var s;			var c = match.charAt(0);			var l = match.length;			var pad;			var widthList = ["abbr", "wide", "narrow"];			switch(c){				case 'G':					if(l>3){dojo.unimplemented("Era format not implemented");}					s = info.eras[dateObject.getFullYear() < 0 ? 1 : 0];					break;				case 'y':					s = dateObject.getFullYear();					switch(l){						case 1:							break;						case 2:							s = String(s).substr(-2);							break;						default:							pad = true;					}					break;				case 'Q':				case 'q':					s = Math.ceil((dateObject.getMonth()+1)/3);					switch(l){						case 1: case 2:							pad = true;							break;						case 3:						case 4:							dojo.unimplemented("Quarter format not implemented");					}					break;				case 'M':				case 'L':					var m = dateObject.getMonth();					var width;					switch(l){						case 1: case 2:							s = m+1; pad = true;							break;						case 3: case 4: case 5:							width = widthList[l-3];							break;					}					if(width){						var type = (c == "L") ? "standalone" : "format";						var prop = ["months",type,width].join("-");						s = info[prop][m];					}					break;				case 'w':					var firstDay = 0;					s = dojo.date.getWeekOfYear(dateObject, firstDay); pad = true;					break;				case 'd':					s = dateObject.getDate(); pad = true;					break;				case 'D':					s = dojo.date.getDayOfYear(dateObject); pad = true;					break;				case 'E':				case 'e':				case 'c': // REVIEW: don't see this in the spec?					var d = dateObject.getDay();					var width;					switch(l){						case 1: case 2:							if(c == 'e'){								var first = dojo.date.getFirstDayOfWeek(options.locale);								d = (d-first+7)%7;							}							if(c != 'c'){								s = d+1; pad = true;								break;							}							// else fallthrough...						case 3: case 4: case 5:							width = widthList[l-3];							break;					}					if(width){						var type = (c == "c") ? "standalone" : "format";						var prop = ["days",type,width].join("-");						s = info[prop][d];					}					break;				case 'a':					var timePeriod = (dateObject.getHours() < 12) ? 'am' : 'pm';					s = info[timePeriod];					break;				case 'h':				case 'H':				case 'K':				case 'k':					var h = dateObject.getHours();					// strange choices in the date format make it impossible to write this succinctly					switch (c) {						case 'h': // 1-12							s = (h % 12) || 12;							break;						case 'H': // 0-23							s = h;							break;						case 'K': // 0-11							s = (h % 12);							break;						case 'k': // 1-24							s = h || 24;							break;					}					pad = true;					break;				case 'm':					s = dateObject.getMinutes(); pad = true;					break;				case 's':					s = dateObject.getSeconds(); pad = true;					break;				case 'S':					s = Math.round(dateObject.getMilliseconds() * Math.pow(10, l-3));					break;				case 'v': // FIXME: don't know what this is. seems to be same as z?				case 'z':					// We only have one timezone to offer; the one from the browser					s = dojo.date.getTimezoneName(dateObject);					if(s){break;}					l=4;					// fallthrough... use GMT if tz not available				case 'Z':					var offset = dateObject.getTimezoneOffset();					var tz = [						(offset<=0 ? "+" : "-"),						dojo.string.pad(Math.floor(Math.abs(offset)/60), 2),						dojo.string.pad(Math.abs(offset)% 60, 2)					];					if(l==4){						tz.splice(0, 0, "GMT");						tz.splice(3, 0, ":");					}					s = tz.join("");					break;				case 'Y':				case 'u':				case 'W':				case 'F':				case 'g':				case 'A':					dojo.debug(match+" modifier not yet implemented");					s = "?";					break;				default:					dojo.raise("dojo.date.format: invalid pattern char: "+pattern);			}			if(pad){ s = dojo.string.pad(s, l); }			return s;		});	}
6315	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/6315/2f1d2cb699c9d9329e8b782b0463156e211cb0f6/struts_dojo.js.uncompressed.js/buggy/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js.uncompressed.js