1// Name: Common.DateTime.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 18.1.0.0 4// FileVersion: 18.1.0.0 5Type.registerNamespace("Sys.Extended.UI"); 6 7Sys.Extended.UI.TimeSpan = function() { 8 // Represents a period of time 9 if (arguments.length == 0) this._ctor$0.apply(this, arguments); 10 else if (arguments.length == 1) this._ctor$1.apply(this, arguments); 11 else if (arguments.length == 3) this._ctor$2.apply(this, arguments); 12 else if (arguments.length == 4) this._ctor$3.apply(this, arguments); 13 else if (arguments.length == 5) this._ctor$4.apply(this, arguments); 14 else throw Error.parameterCount(); 15} 16Sys.Extended.UI.TimeSpan.prototype = { 17 18 _ctor$0 : function() { 19 this._ticks = 0; 20 }, 21 _ctor$1 : function(ticks) { 22 this._ctor$0(); 23 this._ticks = ticks; 24 }, 25 _ctor$2 : function(hours, minutes, seconds) { 26 this._ctor$0(); 27 this._ticks = 28 (hours * Sys.Extended.UI.TimeSpan.TicksPerHour) + 29 (minutes * Sys.Extended.UI.TimeSpan.TicksPerMinute) + 30 (seconds * Sys.Extended.UI.TimeSpan.TicksPerSecond); 31 }, 32 _ctor$3 : function(days, hours, minutes, seconds) { 33 this._ctor$0(); 34 this._ticks = 35 (days * Sys.Extended.UI.TimeSpan.TicksPerDay) + 36 (hours * Sys.Extended.UI.TimeSpan.TicksPerHour) + 37 (minutes * Sys.Extended.UI.TimeSpan.TicksPerMinute) + 38 (seconds * Sys.Extended.UI.TimeSpan.TicksPerSecond); 39 }, 40 _ctor$4 : function(days, hours, minutes, seconds, milliseconds) { 41 this._ctor$0(); 42 this._ticks = 43 (days * Sys.Extended.UI.TimeSpan.TicksPerDay) + 44 (hours * Sys.Extended.UI.TimeSpan.TicksPerHour) + 45 (minutes * Sys.Extended.UI.TimeSpan.TicksPerMinute) + 46 (seconds * Sys.Extended.UI.TimeSpan.TicksPerSecond) + 47 (milliseconds * Sys.Extended.UI.TimeSpan.TicksPerMillisecond); 48 }, 49 50 getDays : function() { 51 return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerDay); 52 }, 53 getHours : function() { 54 return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerHour) % 24; 55 }, 56 getMinutes : function() { 57 return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerMinute) % 60; 58 }, 59 getSeconds : function() { 60 return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerSecond) % 60; 61 }, 62 getMilliseconds : function() { 63 return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerMillisecond) % 1000; 64 }, 65 getDuration : function() { 66 return new Sys.Extended.UI.TimeSpan(Math.abs(this._ticks)); 67 }, 68 getTicks : function() { 69 return this._ticks; 70 }, 71 getTotalDays : function() { 72 Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerDay); 73 }, 74 getTotalHours : function() { 75 return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerHour); 76 }, 77 getTotalMinutes : function() { 78 return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerMinute); 79 }, 80 getTotalSeconds : function() { 81 return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerSecond); 82 }, 83 getTotalMilliseconds : function() { 84 return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerMillisecond); 85 }, 86 add : function(value) { 87 // Adds the supplied TimeSpan to this TimeSpan 88 return new Sys.Extended.UI.TimeSpan(this._ticks + value.getTicks()); 89 }, 90 subtract : function(value) { 91 // Subtracts the supplied TimeSpan to this TimeSpan 92 return new Sys.Extended.UI.TimeSpan(this._ticks - value.getTicks()); 93 }, 94 negate : function() { 95 // Negates the TimeSpan 96 return new Sys.Extended.UI.TimeSpan(-this._ticks); 97 }, 98 equals : function(value) { 99 // Whether this TimeSpan equals another TimeSpan 100 return this._ticks == value.getTicks(); 101 }, 102 compareTo : function(value) { 103 // Whether this TimeSpan greater or less than another TimeSpan 104 if(this._ticks > value.getTicks()) 105 return 1; 106 else if(this._ticks < value.getTicks()) 107 return -1; 108 else 109 return 0; 110 }, 111 toString : function() { 112 return this.format("F"); 113 }, 114 format : function(format) { 115 if (!format) { 116 format = "F"; 117 } 118 if (format.length == 1) { 119 switch (format) { 120 case "t": format = Sys.Extended.UI.TimeSpan.ShortTimeSpanPattern; break; 121 case "T": format = Sys.Extended.UI.TimeSpan.LongTimeSpanPattern; break; 122 case "F": format = Sys.Extended.UI.TimeSpan.FullTimeSpanPattern; break; 123 default: throw Error.createError(String.format(Sys.Extended.UI.Resources.Common_DateTime_InvalidTimeSpan, format)); 124 } 125 } 126 var regex = /dd|d|hh|h|mm|m|ss|s|nnnn|nnn|nn|n/g; 127 var builder = new Sys.StringBuilder(); 128 var ticks = this._ticks; 129 if (ticks < 0) { 130 builder.append("-"); 131 ticks = -ticks; 132 } 133 for (;;) { 134 var index = regex.lastIndex; 135 var ar = regex.exec(format); 136 builder.append(format.slice(index, ar ? ar.index : format.length)); 137 if (!ar) break; 138 switch (ar[0]) { 139 case "dd": 140 case "d": 141 builder.append($common.padLeft(Math.floor(ticks / Sys.Extended.UI.TimeSpan.TicksPerDay, ar[0].length, '0'))); 142 break; 143 case "hh": 144 case "h": 145 builder.append($common.padLeft(Math.floor(ticks / Sys.Extended.UI.TimeSpan.TicksPerHour) % 24, ar[0].length, '0')); 146 break; 147 case "mm": 148 case "m": 149 builder.append($common.padLeft(Math.floor(ticks / Sys.Extended.UI.TimeSpan.TicksPerMinute) % 60, ar[0].length, '0')); 150 break; 151 case "ss": 152 case "s": 153 builder.append($common.padLeft(Math.floor(ticks / Sys.Extended.UI.TimeSpan.TicksPerSecond) % 60, ar[0].length, '0')); 154 break; 155 case "nnnn": 156 case "nnn": 157 case "nn": 158 case "n": 159 builder.append($common.padRight(Math.floor(ticks / Sys.Extended.UI.TimeSpan.TicksPerMillisecond) % 1000, ar[0].length, '0', true)); 160 break; 161 default: 162 Sys.Debug.assert(false); 163 } 164 } 165 return builder.toString(); 166 } 167} 168Sys.Extended.UI.TimeSpan.parse = function(text) { 169 // Parses a text value into a TimeSpan 170 var parts = text.split(":"); 171 var d = 0; 172 var h = 0; 173 var m = 0; 174 var s = 0; 175 var n = 0; 176 var ticks = 0; 177 switch(parts.length) { 178 case 1: 179 if (parts[0].indexOf(".") != -1) { 180 var parts2 = parts[0].split("."); 181 s = parseInt(parts2[0]); 182 n = parseInt(parts2[1]); 183 } else { 184 ticks = parseInt(parts[0]); 185 } 186 break; 187 case 2: 188 h = parseInt(parts[0]); 189 m = parseInt(parts[1]); 190 break; 191 case 3: 192 h = parseInt(parts[0]); 193 m = parseInt(parts[1]); 194 if (parts[2].indexOf(".") != -1) { 195 var parts2 = parts[2].split("."); 196 s = parseInt(parts2[0]); 197 n = parseInt(parts2[1]); 198 } else { 199 s = parseInt(parts[2]); 200 } 201 break; 202 case 4: 203 d = parseInt(parts[0]); 204 h = parseInt(parts[1]); 205 m = parseInt(parts[2]); 206 if (parts[3].indexOf(".") != -1) { 207 var parts2 = parts[3].split("."); 208 s = parseInt(parts2[0]); 209 n = parseInt(parts2[1]); 210 } else { 211 s = parseInt(parts[3]); 212 } 213 break; 214 } 215 ticks += (d * Sys.Extended.UI.TimeSpan.TicksPerDay) + 216 (h * Sys.Extended.UI.TimeSpan.TicksPerHour) + 217 (m * Sys.Extended.UI.TimeSpan.TicksPerMinute) + 218 (s * Sys.Extended.UI.TimeSpan.TicksPerSecond) + 219 (n * Sys.Extended.UI.TimeSpan.TicksPerMillisecond); 220 if(!isNaN(ticks)) { 221 return new Sys.Extended.UI.TimeSpan(ticks); 222 } 223 throw Error.create(Sys.Extended.UI.Resources.Common_DateTime_InvalidFormat); 224} 225Sys.Extended.UI.TimeSpan.fromTicks = function(ticks) { 226 // Creates a TimeSpan for the specified number of ticks 227 return new Sys.Extended.UI.TimeSpan(ticks); 228} 229Sys.Extended.UI.TimeSpan.fromDays = function(days) { 230 // Creates a TimeSpan for the specified number of days 231 return new Sys.Extended.UI.TimeSpan(days * Sys.Extended.UI.TimeSpan.TicksPerDay); 232} 233Sys.Extended.UI.TimeSpan.fromHours = function(hours) { 234 // Creates a TimeSpan for the specified number of hours 235 return new Sys.Extended.UI.TimeSpan(hours * Sys.Extended.UI.TimeSpan.TicksPerHour); 236} 237Sys.Extended.UI.TimeSpan.fromMinutes = function(minutes) { 238 // Creates a TimeSpan for the specified number of minutes 239 return new Sys.Extended.UI.TimeSpan(minutes * Sys.Extended.UI.TimeSpan.TicksPerMinute); 240} 241Sys.Extended.UI.TimeSpan.fromSeconds = function(seconds) { 242 // Creates a TimeSpan for the specified number of seconds 243 return new Sys.Extended.UI.TimeSpan(minutes * Sys.Extended.UI.TimeSpan.TicksPerSecond); 244} 245Sys.Extended.UI.TimeSpan.fromMilliseconds = function(milliseconds) { 246 // Creates a TimeSpan for the specified number of milliseconds 247 return new Sys.Extended.UI.TimeSpan(minutes * Sys.Extended.UI.TimeSpan.TicksPerMillisecond); 248} 249Sys.Extended.UI.TimeSpan.TicksPerDay = 864000000000; 250Sys.Extended.UI.TimeSpan.TicksPerHour = 36000000000; 251Sys.Extended.UI.TimeSpan.TicksPerMinute = 600000000; 252Sys.Extended.UI.TimeSpan.TicksPerSecond = 10000000; 253Sys.Extended.UI.TimeSpan.TicksPerMillisecond = 10000; 254Sys.Extended.UI.TimeSpan.FullTimeSpanPattern = "dd:hh:mm:ss.nnnn"; 255Sys.Extended.UI.TimeSpan.ShortTimeSpanPattern = "hh:mm"; 256Sys.Extended.UI.TimeSpan.LongTimeSpanPattern = "hh:mm:ss"; 257 258Date.prototype.getTimeOfDay = function Date$getTimeOfDay() { 259 // Gets a TimeSpan representing the current time of the Date 260 return new Sys.Extended.UI.TimeSpan( 261 0, 262 this.getHours(), 263 this.getMinutes(),
264 this.getSeconds(), 265 this.getMilliseconds()); 266} 267Date.prototype.getDateOnly = function Date$getDateOnly() { 268 // Gets a Date representing the Date only part of the Date and Adjusts for DST switch at midnight. 269 var tempDate = new Date(this.getFullYear(), this.getMonth(), this.getDate()); 270 271 if (!((this.getMonth() === tempDate.getMonth()) && (this.getDate() === tempDate.getDate()))) { 272 273 tempDate.setMinutes(120); 274 275 } 276 277 return tempDate; 278} 279Date.prototype.add = function Date$add(span) { 280 // Adds a TimeSpan to the current Date 281 // param "span"is the amount of time to add to the date 282 283 return new Date(this.getTime() + span.getTotalMilliseconds()); 284} 285Date.prototype.subtract = function Date$subtract(span) { 286 // Subtracts a TimeSpan to the current Date 287 // param "span" is the amount of time to subtract from the date 288 return this.add(span.negate()); 289} 290Date.prototype.getTicks = function Date$getTicks() { 291 return this.getTime() * Sys.Extended.UI.TimeSpan.TicksPerMillisecond; 292} 293 294Sys.Extended.UI.FirstDayOfWeek = function() { 295} 296Sys.Extended.UI.FirstDayOfWeek.prototype = { 297 Sunday : 0, 298 Monday : 1, 299 Tuesday : 2, 300 Wednesday : 3, 301 Thursday : 4, 302 Friday : 5, 303 Saturday : 6, 304 Default : 7 305} 306Sys.Extended.UI.FirstDayOfWeek.registerEnum("Sys.Extended.UI.FirstDayOfWeek");
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.