4 |
this.sYear = form.year || form.elements[2] || null; |
this.sYear = form.year || form.elements[2] || null; |
5 |
this.yBefore = before || 0; |
this.yBefore = before || 0; |
6 |
this.yAfter = after || 0; |
this.yAfter = after || 0; |
7 |
this.BaseDate = date || new Date(); |
this.BaseDate = date || null; |
8 |
|
if (!this.BaseDate) { |
9 |
|
this.BaseDate = new Date(); |
10 |
|
this.BaseDate = new Date(this.BaseDate.getYear(), |
11 |
|
this.BaseDate.getMonth() + 1, this.BaseDate.getDate()); |
12 |
|
} else { |
13 |
|
this.BaseDate = new Date(this.BaseDate.getYear(), |
14 |
|
this.BaseDate.getMonth() - 1, this.BaseDate.getDate()); |
15 |
|
} |
16 |
this.Rebuild = function(d, m, y) { |
this.Rebuild = function(d, m, y) { |
17 |
var i, sel; |
var i, sel; |
18 |
// build day selector |
// build day selector |
28 |
} |
} |
29 |
// build month selector |
// build month selector |
30 |
if (this.sMonth != null) { |
if (this.sMonth != null) { |
31 |
sel = m || this.sMonth.selectedIndex; |
sel = (m - 1) || this.sMonth.selectedIndex; |
32 |
if (sel < 0) sel = this.BaseDate.getMonth(); |
if (sel < 0) sel = this.BaseDate.getMonth(); |
33 |
for (i = 0; i < this.sMonth.options.length; i++) |
for (i = 0; i < this.sMonth.options.length; i++) |
34 |
this.sMonth.options[i] = null; |
this.sMonth.options[i] = null; |
58 |
} |
} |
59 |
this.Check = function(d, m, y) { |
this.Check = function(d, m, y) { |
60 |
var n = new Array(31, -1, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
var n = new Array(31, -1, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
61 |
m = m || (this.sMonth != null && this.sMonth.options.selectedIndex >= 0) ? |
if (!m) m = (this.sMonth != null && this.sMonth.options.selectedIndex >= 0) ? |
62 |
parseInt(this.sMonth.options[this.sMonth.selectedIndex].value) : this.BaseDate.getMonth() + 1; |
parseInt(this.sMonth.options[this.sMonth.selectedIndex].value) : this.BaseDate.getMonth(); |
63 |
y = y || (this.sYear != null && this.sYear.options.selectedIndex >= 0) ? |
if (!y) y = (this.sYear != null && this.sYear.options.selectedIndex >= 0) ? |
64 |
parseInt(this.sYear.options[this.sYear.selectedIndex].text) : this.BaseDate.getYear(); |
parseInt(this.sYear.options[this.sYear.selectedIndex].text) : this.BaseDate.getYear(); |
65 |
if (y < 1900) y += 1900; |
if (y < 1900) y += 1900; |
66 |
n[1] = ((y % 4 == 0) && (y % 100 != 0)) ? 29 : 28; |
n[1] = ((y % 4 == 0) && (y % 100 != 0)) ? 29 : 28; |
76 |
this.Today = function() { |
this.Today = function() { |
77 |
var t = new Date(); |
var t = new Date(); |
78 |
var d = t.getDate() - 1; |
var d = t.getDate() - 1; |
79 |
var m = t.getMonth(); |
var m = t.getMonth() + 1; |
80 |
var y = this.yBefore; |
var y = this.yBefore; |
81 |
this.Check(d, m, y); |
this.Check(d, m, y); |
82 |
|
this.Check(d, m, y); |
83 |
this.Rebuild(d, m, y); |
this.Rebuild(d, m, y); |
84 |
} |
} |
85 |
this.nDays = null; |
this.nDays = null; |
86 |
this.Reset(); |
this.Reset(); |
|
this.Check(); |
|
|
this.Rebuild(); |
|
87 |
return this; |
return this; |
88 |
} |
} |