Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Zoho Docs
Google Docs
Each Attachment size should not exceed 1MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Move this topic
Forum :
Getting Started
Using jQuery
Using jQuery Plugins
Using jQuery UI
Developing jQuery Core
Developing jQuery Plugins
Developing jQuery UI
QUnit and Testing
About the jQuery Forum
jQuery Conferences
jQuery Mobile
Developing jQuery Mobile
Sub forum :
Move this topic
Cancel
Using jQuery UI
bowana01
How do I restrict the start date and the end date to the same month?
in
Using jQuery UI
•
4 months ago
<script type="text/javascript">
$(function() {
$( "#from" ).datepicker({
defaultDate: "+1w",
numberOfMonths: 1,
onSelect: function( selectedDate ) {
$( "#to" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#to" ).datepicker({
defaultDate: "+1w",
numberOfMonths: 1,
onSelect: function( selectedDate ) {
$( "#from" ).datepicker( "option", "maxDate", selectedDate );
}
});
$( "input[type=submit]" )
.button()
});
</script>
1
Reply
Replies(2)
kbwood.au
Re: How do I restrict the start date and the end date to the same month?
4 months ago
Something like this:
$(function() {
$.datepicker.setDefaults({defaultDate: '+1w'});
$('#from').datepicker({onSelect: function(dateStr) {
var date = $(this).datepicker('getDate');
var endMonth = null;
if (date) {
endMonth = new Date(date.getTime());
endMonth.setMonth(endMonth.getMonth() + 1);
endMonth.setDate(0);
}
$('#to').datepicker('option', {minDate: date, maxDate: endMonth});
}});
$('#to').datepicker({onSelect: function(dateStr) {
var date = $(this).datepicker('getDate');
var startMonth = null;
if (date) {
startMonth = new Date(date.getTime());
startMonth.setDate(1);
}
$('#from').datepicker('option', {minDate: startMonth, maxDate: date});
}});
});
Leave a comment on kbwood.au's reply
bowana01
Re: How do I restrict the start date and the end date to the same month?
4 months ago
Disregard this comment. Working on another problem related to this so might need some further help.
Leave a comment on bowana01's reply
Change topic type
Topic Type :
Discussions
Questions
Ideas
Problems
No of days :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Change topic type
Cancel
Link this topic
Provide the permalink of a topic that is related to this topic
Permalink
Save
Close
Reply to bowana01's question
Top
Reply
{"z2953500":[14737000003817027],"z23810414":[14737000003756017,14737000003850117]}
Statistics
2
Replies
348
Views
0
Followers
Tags
Cancel
datepicker
restrict month
Actions
Permalink
Related Posts
Datepicker showing multiple months ...
datepicker + time picker?
jQuery UI 1.8.13 with jQuery 1.3.2
datepicker autoselects and fires on...
Datepicker Positioning