PageSourceSearch

https://notnul.com/ScriptResource.axd?d=yU8qy6lBkK3tBrsJLcY-r-mJuj…-yx53jU169iQGU0_UXZ83tV1awCt6yD0&t=51e37521

js notnul.com collected 2026-09-24 20:11:53 UTC 19,361 bytes, 521 lines download raw bytes

1// Name:        Common.DateTime.debug.js
2// Assembly:    AjaxControlToolkit
3// Version:     4.1.7.1213
4// FileVersion: 4.1.7.1213
5// (c) 2010 CodePlex Foundation
6
7
8
9/// <reference name="MicrosoftAjax.debug.js" />
10/// <reference name="MicrosoftAjaxTimer.debug.js" />
11/// <reference name="MicrosoftAjaxWebForms.debug.js" />
12/// <reference path="../Common/Common.js" />
13
14(function() {
15var scriptName = "ExtendedDateTime";
16
17function execute() {
18
19
20Type.registerNamespace("Sys.Extended.UI");
21
22Sys.Extended.UI.TimeSpan = function() {
23    /// <summary>
24    /// Represents a period of time
25    /// </summary>
26    
27    if (arguments.length == 0) this._ctor$0.apply(this, arguments);
28    else if (arguments.length == 1) this._ctor$1.apply(this, arguments);
29    else if (arguments.length == 3) this._ctor$2.apply(this, arguments);
30    else if (arguments.length == 4) this._ctor$3.apply(this, arguments);
31    else if (arguments.length == 5) this._ctor$4.apply(this, arguments);
32    else throw Error.parameterCount();
33}
34Sys.Extended.UI.TimeSpan.prototype = {
35
36    _ctor$0 : function() {
37        /// <summary>
38        /// Initializes a new TimeSpan
39        /// </summary>
40        
41        this._ticks = 0;
42    }, 
43    _ctor$1 : function(ticks) {
44        /// <summary>
45        /// Initializes a new TimeSpan
46        /// </summary>
47        /// <param name="ticks" type="Number" integer="true">The number of ticks in the TimeSpan</param>
48
49        this._ctor$0();
50        this._ticks = ticks;
51    },
52    _ctor$2 : function(hours, minutes, seconds) {
53        /// <summary>
54        /// Initializes a new TimeSpan
55        /// </summary>
56        /// <param name="hours" type="Number">The number of hours in the TimeSpan</param>
57        /// <param name="minutes" type="Number">The number of minutes in the TimeSpan</param>
58        /// <param name="seconds" type="Number">The number of seconds in the TimeSpan</param>
59        
60        this._ctor$0();
61        this._ticks = 
62            (hours * Sys.Extended.UI.TimeSpan.TicksPerHour) +
63            (minutes * Sys.Extended.UI.TimeSpan.TicksPerMinute) +
64            (seconds * Sys.Extended.UI.TimeSpan.TicksPerSecond); 
65    },
66    _ctor$3 : function(days, hours, minutes, seconds) {
67        /// <summary>
68        /// Initializes a new TimeSpan
69        /// </summary>
70        /// <param name="days" type="Number">The number of days in the TimeSpan</param>
71        /// <param name="hours" type="Number">The number of hours in the TimeSpan</param>
72        /// <param name="minutes" type="Number">The number of minutes in the TimeSpan</param>
73        /// <param name="seconds" type="Number">The number of seconds in the TimeSpan</param>
74
75        this._ctor$0();
76        this._ticks = 
77            (days * Sys.Extended.UI.TimeSpan.TicksPerDay) +
78            (hours * Sys.Extended.UI.TimeSpan.TicksPerHour) +
79            (minutes * Sys.Extended.UI.TimeSpan.TicksPerMinute) +
80            (seconds * Sys.Extended.UI.TimeSpan.TicksPerSecond); 
81    },
82    _ctor$4 : function(days, hours, minutes, seconds, milliseconds) {
83        /// <summary>
84        /// Initializes a new TimeSpan
85        /// </summary>
86        /// <param name="days" type="Number">The number of days in the TimeSpan</param>
87        /// <param name="hours" type="Number">The number of hours in the TimeSpan</param>
88        /// <param name="minutes" type="Number">The number of minutes in the TimeSpan</param>
89        /// <param name="seconds" type="Number">The number of seconds in the TimeSpan</param>
90        /// <param name="milliseconds" type="Number">The number of milliseconds in the TimeSpan</param>
91
92        this._ctor$0();
93        this._ticks = 
94            (days * Sys.Extended.UI.TimeSpan.TicksPerDay) +
95            (hours * Sys.Extended.UI.TimeSpan.TicksPerHour) +
96            (minutes * Sys.Extended.UI.TimeSpan.TicksPerMinute) +
97            (seconds * Sys.Extended.UI.TimeSpan.TicksPerSecond) +
98            (milliseconds * Sys.Extended.UI.TimeSpan.TicksPerMillisecond); 
99    },
100
101    getDays : function() { 
102        /// <summary>
103        /// Gets the days part of the TimeSpan
104        /// </summary>
105        /// <returns type="Number" />
106        
107        return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerDay); 
108    },
109    getHours : function() { 
110        /// <summary>
111        /// Gets the hours part of the TimeSpan
112        /// </summary>
113        /// <returns type="Number" />
114
115        return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerHour) % 24; 
116    },
117    getMinutes : function() { 
118        /// <summary>
119        /// Gets the minutes part of the TimeSpan
120        /// </summary>
121        /// <returns type="Number" />
122
123        return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerMinute) % 60; 
124    },
125    getSeconds : function() { 
126        /// <summary>
127        /// Gets the seconds part of the TimeSpan
128        /// </summary>
129        /// <returns type="Number" />
130
131        return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerSecond) % 60; 
132    },
133    getMilliseconds : function() { 
134        /// <summary>
135        /// Gets the milliseconds part of the TimeSpan
136        /// </summary>
137        /// <returns type="Number" />
138
139        return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerMillisecond) % 1000; 
140    },
141    getDuration : function() { 
142        /// <summary>
143        /// Gets the total duration of a TimeSpan
144        /// </summary>
145        /// <returns type="Sys.Extended.UI.TimeSpan" />
146
147        return new Sys.Extended.UI.TimeSpan(Math.abs(this._ticks)); 
148    },
149    getTicks : function() { 
150        /// <summary>
151        /// Gets the ticks in the TimeSpan
152        /// </summary>
153        /// <returns type="Number" />
154    
155        return this._ticks; 
156    },
157    getTotalDays : function() { 
158        /// <summary>
159        /// Gets the total number of days in the TimeSpan
160        /// </summary>
161        /// <returns type="Number" />
162
163        Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerDay); 
164    },
165    getTotalHours : function() { 
166        /// <summary>
167        /// Gets the total hours in the TimeSpan
168        /// </summary>
169        /// <returns type="Number" />
170
171        return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerHour); 
172    },
173    getTotalMinutes : function() { 
174        /// <summary>
175        /// Gets the total minutes in the TimeSpan
176        /// </summary>
177        /// <returns type="Number" />
178
179        return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerMinute); 
180    },
181    getTotalSeconds : function() { 
182        /// <summary>
183        /// Gets the total seconds in the TimeSpan
184        /// </summary>
185        /// <returns type="Number" />
186
187        return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerSecond); 
188    },
189    getTotalMilliseconds : function() { 
190        /// <summary>
191        /// Gets the total milliseconds in the TimeSpan
192        /// </summary>
193        /// <returns type="Number" />
194
195        return Math.floor(this._ticks / Sys.Extended.UI.TimeSpan.TicksPerMillisecond); 
196    },
197    add : function(value) { 
198        /// <summary>
199        /// Adds the supplied TimeSpan to this TimeSpan
200        /// </summary>
201        /// <param name="value" type="Sys.Extended.UI.TimeSpan">The TimeSpan to add</param>
202        /// <returns type="Sys.Extended.UI.TimeSpan" />
203
204        return new Sys.Extended.UI.TimeSpan(this._ticks + value.getTicks()); 
205    },
206    subtract : function(value) { 
207        /// <summary>
208        /// Subtracts the supplied TimeSpan to this TimeSpan
209        /// </summary>
210        /// <param name="value" type="Sys.Extended.UI.TimeSpan">The TimeSpan to subtract</param>
211        /// <returns type="Sys.Extended.UI.TimeSpan" />
212
213        return new Sys.Extended.UI.TimeSpan(this._ticks - value.getTicks()); 
214    },
215    negate : function() { 
216        /// <summary>
217        /// Negates the TimeSpan
218        /// </summary>
219        /// <returns type="Sys.Extended.UI.TimeSpan" />
220
221        return new Sys.Extended.UI.TimeSpan(-this._ticks); 
222    },
223    equals : function(value) { 
224        /// <summary>
225        /// Whether this TimeSpan equals another TimeSpan
226        /// </summary>
227        /// <param name="value" type="Sys.Extended.UI.TimeSpan">The TimeSpan to test</param>
228        /// <returns type="Sys.Extended.UI.TimeSpan" />
229
230        return this._ticks == value.getTicks(); 
231    },
232    compareTo : function(value) { 
233        /// <summary>
234        /// Whether this TimeSpan greater or less than another TimeSpan
235        /// </summary>
236        /// <param name="value" type="Sys.Extended.UI.TimeSpan">The TimeSpan to test</param>
237        /// <returns type="Sys.Extended.UI.TimeSpan" />
238
239        if(this._ticks > value.getTicks()) 
240            return 1; 
241        else if(this._ticks < value.getTicks()) 
242            return -1; 
243        else 
244            return 0; 
245    },
246    toString : function() { 
247        /// <summary>
248        /// Gets the string representation of the TimeSpan
249        /// </summary>
250        /// <returns type="String" />
251
252        return this.format("F"); 
253    },
254    format : function(format) {    
255        /// <summary>
256        /// Gets the string representation of the TimeSpan
257        /// </summary>
258        /// <param name="format" type="String" mayBeNull="true">The format specifier used to format the TimeSpan</param>
259        /// <returns type="String" />
260
261        if (!format) {
262            format = "F";
263        }
264        if (format.length == 1) {
265            switch (format) {
266                case "t": format = Sys.Extended.UI.TimeSpan.ShortTimeSpanPattern; break;
267                case "T": format = Sys.Extended.UI.TimeSpan.LongTimeSpanPattern; break;
268                case "F": format = Sys.Extended.UI.TimeSpan.FullTimeSpanPattern; break;
269                default: throw Error.createError(String.format(Sys.Extended.UI.Resources.Common_DateTime_InvalidTimeSpan, format));
270            }
271        }
272        var regex = /dd|d|hh|h|mm|m|ss|s|nnnn|nnn|nn|n/g;
273        var builder = new Sys.StringBuilder();
274        var ticks = this._ticks;
275        if (ticks < 0) {
276            builder.append("-");            
277            ticks = -ticks;
278        }
279        for (;;) {
280            var index = regex.lastIndex;
281            var ar = regex.exec(format);
282            builder.append(format.slice(index, ar ? ar.index : format.length));
283            if (!ar) break;
284            switch (ar[0]) {
285                case "dd":
286                case "d":
287                    builder.append($common.padLeft(Math.floor(ticks / Sys.Extended.UI.TimeSpan.TicksPerDay, ar[0].length, '0')));
288                    break;
289                case "hh":
290                case "h":
291                    builder.append($common.padLeft(Math.floor(ticks / Sys.Extended.UI.TimeSpan.TicksPerHour) % 24, ar[0].length, '0'));
292                    break;
293                case "mm":
294                case "m":
295                    builder.append($common.padLeft(Math.floor(ticks / Sys.Extended.UI.TimeSpan.TicksPerMinute) % 60, ar[0].length, '0'));
296                    break;
297                case "ss":
298                case "s":
299                    builder.append($common.padLeft(Math.floor(ticks / Sys.Extended.UI.TimeSpan.TicksPerSecond) % 60, ar[0].length, '0'));
300                    break;
301                case "nnnn":
302                case "nnn":
303                case "nn":
304                case "n":
305                    builder.append($common.padRight(Math.floor(ticks / Sys.Extended.UI.TimeSpan.TicksPerMillisecond) % 1000, ar[0].length, '0', true));
306                    break;
307                default:
308                    Sys.Debug.assert(false);
309            }
310        }
311        return builder.toString();
312    }
313}
314Sys.Extended.UI.TimeSpan.parse = function(text) {
315    /// <summary>
316    /// Parses a text value into a TimeSpan
317    /// </summary>
318    /// <param name="text" type="String">The text to parse</param>
319    /// <returns type="Sys.Extended.UI.TimeSpan" />
320
321    var parts = text.split(":");
322    var d = 0;
323    var h = 0;
324    var m = 0;
325    var s = 0;
326    var n = 0;
327    var ticks = 0;    
328    switch(parts.length) {
329        case 1:
330            if (parts[0].indexOf(".") != -1) {
331                var parts2 = parts[0].split(".");
332                s = parseInt(parts2[0]);
333                n = parseInt(parts2[1]);
334            } else {
335                ticks = parseInt(parts[0]);
336            }
337            break;
338        case 2:
339            h = parseInt(parts[0]);
340            m = parseInt(parts[1]);
341            break;
342        case 3:
343            h = parseInt(parts[0]);
344            m = parseInt(parts[1]);
345            if (parts[2].indexOf(".") != -1) {
346                var parts2 = parts[2].split(".");
347                s = parseInt(parts2[0]);
348                n = parseInt(parts2[1]);
349            } else {
350                s = parseInt(parts[2]);
351            }
352            break;
353        case 4:
354            d = parseInt(parts[0]);
355            h = parseInt(parts[1]);
356            m = parseInt(parts[2]);
357            if (parts[3].indexOf(".") != -1) {
358                var parts2 = parts[3].split(".");
359                s = parseInt(parts2[0]);
360                n = parseInt(parts2[1]);
361            } else {
362                s = parseInt(parts[3]);
363            }
364            break;
365    }
366    ticks += (d * Sys.Extended.UI.TimeSpan.TicksPerDay) +
367             (h * Sys.Extended.UI.TimeSpan.TicksPerHour) +
368             (m * Sys.Extended.UI.TimeSpan.TicksPerMinute) +
369             (s * Sys.Extended.UI.TimeSpan.TicksPerSecond) +
370             (n * Sys.Extended.UI.TimeSpan.TicksPerMillisecond);
371    if(!isNaN(ticks)) {
372        return new Sys.Extended.UI.TimeSpan(ticks);
373    }    
374    throw Error.create(Sys.Extended.UI.Resources.Common_DateTime_InvalidFormat);
375}
376Sys.Extended.UI.TimeSpan.fromTicks = function(ticks) { 
377    /// <summary>
378    /// Creates a TimeSpan for the specified number of ticks
379    /// </summary>
380    /// <param name="ticks" type="Number" integer="true">The ticks for the TimeSpan instance</param>
381    /// <returns type="Sys.Extended.UI.TimeSpan" />
382
383    return new Sys.Extended.UI.TimeSpan(ticks); 
384}
385Sys.Extended.UI.TimeSpan.fromDays = function(days) { 
386    /// <summary>
387    /// Creates a TimeSpan for the specified number of days
388    /// </summary>
389    /// <param name="days" type="Number">The days for the TimeSpan instance</param>
390    /// <returns type="Sys.Extended.UI.TimeSpan" />
391
392    return new Sys.Extended.UI.TimeSpan(days * Sys.Extended.UI.TimeSpan.TicksPerDay); 
393}
394Sys.Extended.UI.TimeSpan.fromHours = function(hours) { 
395    /// <summary>
396    /// Creates a TimeSpan for the specified number of hours
397    /// </summary>
398    /// <param name="hours" type="Number">The hours for the TimeSpan instance</param>
399    /// <returns type="Sys.Extended.UI.TimeSpan" />
400
401    return new Sys.Extended.UI.TimeSpan(hours * Sys.Extended.UI.TimeSpan.TicksPerHour); 
402}
403Sys.Extended.UI.TimeSpan.fromMinutes = function(minutes) { 
404    /// <summary>
405    /// Creates a TimeSpan for the specified number of minutes
406    /// </summary>
407    /// <param name="minutes" type="Number">The minutes for the TimeSpan instance</param>
408    /// <returns type="Sys.Extended.UI.TimeSpan" />
409
410    return new Sys.Extended.UI.TimeSpan(minutes * Sys.Extended.UI.TimeSpan.TicksPerMinute); 
411}
412Sys.Extended.UI.TimeSpan.fromSeconds = function(seconds) { 
413    /// <summary>
414    /// Creates a TimeSpan for the specified number of seconds
415    /// </summary>
416    /// <param name="seconds" type="Number">The seconds for the TimeSpan instance</param>
417    /// <returns type="Sys.Extended.UI.TimeSpan" />
418
419    return new Sys.Extended.UI.TimeSpan(minutes * Sys.Extended.UI.TimeSpan.TicksPerSecond); 
420}
421Sys.Extended.UI.TimeSpan.fromMilliseconds = function(milliseconds) { 
422    /// <summary>
423    /// Creates a TimeSpan for the specified number of milliseconds
424    /// </summary>
425    /// <param name="days" type="Number">The milliseconds for the TimeSpan instance</param>
426    /// <returns type="Sys.Extended.UI.TimeSpan" />
427
428    return new Sys.Extended.UI.TimeSpan(minutes * Sys.Extended.UI.TimeSpan.TicksPerMillisecond); 
429}
430Sys.Extended.UI.TimeSpan.TicksPerDay = 864000000000;
431Sys.Extended.UI.TimeSpan.TicksPerHour = 36000000000;
432Sys.Extended.UI.TimeSpan.TicksPerMinute = 600000000;
433Sys.Extended.UI.TimeSpan.TicksPerSecond = 10000000;
434Sys.Extended.UI.TimeSpan.TicksPerMillisecond = 10000;
435Sys.Extended.UI.TimeSpan.FullTimeSpanPattern = "dd:hh:mm:ss.nnnn";
436Sys.Extended.UI.TimeSpan.ShortTimeSpanPattern = "hh:mm";
437Sys.Extended.UI.TimeSpan.LongTimeSpanPattern = "hh:mm:ss";
438
439Date.prototype.getTimeOfDay = function Date$getTimeOfDay() {
440    /// <summary>
441    /// Gets a TimeSpan representing the current time of the Date
442    /// </summary>
443    /// <returns type="Sys.Extended.UI.TimeSpan" />
444
445    return new Sys.Extended.UI.TimeSpan(
446        0, 
447        this.getHours(), 
448        this.getMinutes(), 
449        this.getSeconds(), 
450        this.getMilliseconds());
451}
452Date.prototype.getDateOnly = function Date$getDateOnly() {
453    /// <summary>
454    /// Gets a Date representing the Date only part of the Date and Adjusts for DST switch at midnight.
455    /// </summary>
456    /// <returns type="Date" />
457
458    var tempDate = new Date(this.getFullYear(), this.getMonth(), this.getDate());
459
460    if (!((this.getMonth() === tempDate.getMonth()) && (this.getDate() === tempDate.getDate()))) {
461
462        tempDate.setMinutes(120);
463
464    }
465
466    return tempDate;
467}
468Date.prototype.add = function Date$add(span) {
469    /// <summary>
470    /// Adds a TimeSpan to the current Date
471    /// </summary>
472    /// <param name="span" type="Sys.Extended.UI.TimeSpan">The amount of time to add to the date</param>
473    /// <returns type="Date" />
474
475    return new Date(this.getTime() + span.getTotalMilliseconds());
476}
477Date.prototype.subtract = function Date$subtract(span) {
478    /// <summary>
479    /// Subtracts a TimeSpan to the current Date
480    /// </summary>
481    /// <param name="span" type="Sys.Extended.UI.TimeSpan">The amount of time to subtract from the date</param>
482    /// <returns type="Date" />
483
484    return this.add(span.negate());
485}
486Date.prototype.getTicks = function Date$getTicks() {
487    /// <summary>
488    /// Gets the number of ticks in the date
489    /// </summary>
490    /// <returns type="Number" />
491
492    return this.getTime() * Sys.Extended.UI.TimeSpan.TicksPerMillisecond;
493}
494
495Sys.Extended.UI.FirstDayOfWeek = function() {
496    /// <summary>
497    /// Represents the first day of the week in a calendar
498    /// </summary>
499}
500Sys.Extended.UI.FirstDayOfWeek.prototype = {
501    Sunday : 0,
502    Monday : 1,
503    Tuesday : 2,
504    Wednesday : 3,
505    Thursday : 4,
506    Friday : 5,
507    Saturday : 6,
508    Default : 7
509}
510Sys.Extended.UI.FirstDayOfWeek.registerEnum("Sys.Extended.UI.FirstDayOfWeek");
511
512} // execute
513
514if (window.Sys && Sys.loader) {
515    Sys.loader.registerScript(scriptName, ["ExtendedCommon"], execute);
516}
517else {
518    execute();
519}
520
521})();

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.