Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 85655d7

Browse filesBrowse files
committed
better handling of min/max dates in selectors
1 parent 66b187a commit 85655d7
Copy full SHA for 85655d7

File tree

Expand file treeCollapse file tree

3 files changed

+14
-22
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+14
-22
lines changed

‎build.xml

Copy file name to clipboardExpand all lines: build.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<project name="jQuery.Tools" default="min">
22

33
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
4-
<property name="version" value="1.2.4"/>
4+
<property name="version" value="1.2.5"/>
55
<property name="build" value="build/${version}"/>
66
<property name="file" value="none"/>
77

‎src/dateinput/dateinput.js

Copy file name to clipboardExpand all lines: src/dateinput/dateinput.js
+10-16Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -457,24 +457,18 @@
457457

458458
//{{{ setValue
459459

460-
setValue: function(year, month, day) {
460+
setValue: function(year, month, day) {
461461

462+
var date = integer(month) >= -1 ?
463+
new Date(integer(year), integer(month), integer(day || 1)) : year || value
464+
;
462465

463-
var date;
464-
465-
if (parseInt(month, 10) >= -1) {
466-
// strings to numbers
467-
year = integer(year);
468-
month = integer(month);
469-
day = integer(day);
470-
date = new Date(year, month, day);
471-
472-
} else {
473-
date = year || value;
474-
year = date.getFullYear();
475-
month = date.getMonth();
476-
day = date.getDate();
477-
}
466+
if (date < min) { date = min; }
467+
else if (date > max) { date = max; }
468+
469+
year = date.getFullYear();
470+
month = date.getMonth();
471+
day = date.getDate();
478472

479473

480474
// roll year & month

‎test/dateinput/setmin.htm

Copy file name to clipboardExpand all lines: test/dateinput/setmin.htm
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
<link rel="stylesheet" type="text/css" href="skin1.css"/>
66

77
<!-- HTML5 date input -->
8-
<input type="date" name="mydate" data-value="2010-12-01" min="2010-12-01" />
8+
<input type="date" name="mydate" data-value="2010-12-01" min="2010-12-01" max="2011-12-02" />
99

10-
<input type="date" name="mydate" data-value="2010-12-01" min="2010-12-01" />
10+
<input type="date" name="mydate" data-value="2010-12-01" min="2010-12-01" max="2012-07-01" />
1111

1212
<!-- make it happen -->
1313
<script>
14-
$(":date:first").dateinput({selectors: true});
15-
16-
$(":date:last").dateinput({selectors: false});
14+
$(":date").dateinput({selectors: true});
1715
</script>
1816

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.