jquery / jquery/jquery-ui

Maybe a bug with date selector - from and to date selectors, can not select past the to date if i was to set both the same date.

Open
#2,177 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Comp: Datepicker Needs info
Dominant language
JavaScript
Stars
11.3k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

If I select the "from" date then select the "to" date as the same date as the "from" date, I now can not select the "from" date to any date unless I change the "to" date to a date past the "from" date first, then I can change the "to" date. I am wanting to be able to select any date for the "from" or "to" selectors as long as both are todays date or in the future.
`<script>
$(function() {

$( "#from" ).datepicker({
	minDate: new Date(),
	defaultDate: "+1w",
	changeMonth: true,
	numberOfMonths: 1,
	onClose: function( selectedDate ) {
	$( "#to" ).datepicker( "option", "minDate", selectedDate );
	}
});
$( "#to" ).datepicker({
	//minDate: new Date(),
	defaultDate: "+1w",
	regional: "en",
	changeMonth: true,
	numberOfMonths: 1,
	onClose: function( selectedDate ) {
	$( "#from" ).datepicker( "option", "maxDate", selectedDate );
	}
});

}); </script>`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the two datepicker instances for #from and #to, focusing on the onClose callbacks that set minDate and maxDate. Trace datepicker option handling for equal dates and verify that both selectors can choose any date from today onward after either order of selection; add regression coverage if the relevant test entry point is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.