Upgrade to ExtJS 3.3.1 - Released 11/30/2010
[extjs.git] / examples / docs / source / Ext.calendar.html
1 <html>
2 <head>
3   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
4   <title>The source code</title>
5     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 </head>
8 <body  onload="prettyPrint();">
9     <pre class="prettyprint lang-js">/*!
10  * Ext JS Library 3.3.1
11  * Copyright(c) 2006-2010 Sencha Inc.
12  * licensing@sencha.com
13  * http://www.sencha.com/license
14  */
15 Ext.ns('Ext.calendar');
16
17  (function() {
18     Ext.apply(Ext.calendar, {
19         Date: {
20             diffDays: function(start, end) {
21                 day = 1000 * 60 * 60 * 24;
22                 diff = end.clearTime(true).getTime() - start.clearTime(true).getTime();
23                 return Math.ceil(diff / day);
24             },
25
26             copyTime: function(fromDt, toDt) {
27                 var dt = toDt.clone();
28                 dt.setHours(
29                 fromDt.getHours(),
30                 fromDt.getMinutes(),
31                 fromDt.getSeconds(),
32                 fromDt.getMilliseconds());
33
34                 return dt;
35             },
36
37             compare: function(dt1, dt2, precise) {
38                 if (precise !== true) {
39                     dt1 = dt1.clone();
40                     dt1.setMilliseconds(0);
41                     dt2 = dt2.clone();
42                     dt2.setMilliseconds(0);
43                 }
44                 return dt2.getTime() - dt1.getTime();
45             },
46
47             // private helper fn
48             maxOrMin: function(max) {
49                 var dt = (max ? 0: Number.MAX_VALUE),
50                 i = 0,
51                 args = arguments[1],
52                 ln = args.length;
53                 for (; i < ln; i++) {
54                     dt = Math[max ? 'max': 'min'](dt, args[i].getTime());
55                 }
56                 return new Date(dt);
57             },
58
59             max: function() {
60                 return this.maxOrMin.apply(this, [true, arguments]);
61             },
62
63             min: function() {
64                 return this.maxOrMin.apply(this, [false, arguments]);
65             }
66         }
67     });
68 })();</pre>    
69 </body>
70 </html>