Skip to content

Commit 11317ba

Browse files
committed
made old years work.
1 parent 14ef49a commit 11317ba

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

src/dateinput/dateinput.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@
192192
min = parseDate(min || conf.yearRange[0] * 365);
193193
max = parseDate(max || conf.yearRange[1] * 365);
194194

195+
195196
// check that language exists
196197
if (!labels) { throw "Dateinput: invalid language: " + conf.lang; }
197198

@@ -441,6 +442,7 @@
441442

442443
setValue: function(year, month, day) {
443444

445+
444446
var date;
445447

446448
if (parseInt(month, 10) >= 0) {
@@ -450,14 +452,14 @@
450452
day = integer(day);
451453
date = new Date(year, month, day);
452454

453-
} else {
454-
455+
} else {
455456
date = year || value;
456-
year = date.getYear() % 100 + 2000;
457+
year = date.getYear() + 1900;
457458
month = date.getMonth();
458459
day = date.getDate();
459460
}
460461

462+
461463
// roll year & month
462464
if (month == -1) {
463465
month = 11;

test/dateinput/customized.htm

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
<script src="../js/jquery-1.4.2.js"></script>
3+
<script src="../../src/dateinput/dateinput.js"></script>
4+
5+
<link rel="stylesheet" type="text/css" href="skin1.css"/>
6+
7+
8+
<!-- HTML5 date input -->
9+
<input type="date" name="mydate" />
10+
11+
<!-- make it happen -->
12+
<script>
13+
var begdat = new Date(1980,1,1);
14+
var mindat = new Date(1940,1,1);
15+
var maxdat = new Date(1992,1,1);
16+
17+
18+
$(":date").dateinput({value: begdat, max: maxdat, min: mindat});
19+
</script>
20+
21+
22+

test/dateinput/next.gif

601 Bytes
Loading

test/dateinput/prev.gif

599 Bytes
Loading

0 commit comments

Comments
 (0)