jquery / jquery/jquery-ui

Selector: 100 years or more causes wrong date to be selected

Open
#2,046 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Behavior shared with 1.12
Dominant language
JavaScript
Stars
11.3k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

Hello there i was testing a Selector : DatePicker and added a date range with years -100 and + 100

props.setDatePicker = (idItem) => {
let _default = $(#${idItem}).val();
if (_default === "01/01/0001")
$(#${idItem}).val(null);
$(#${idItem}).datepicker({
showOn: 'focus',
changeMonth: true,
changeYear: true,
altFormat: "mm/dd/yy",
dateFormat: "mm/dd/yy",
yearRange: "-100:+100",
beforeShow: function () {
setTimeout(function () {
$('.ui-datepicker').css('z-index', 99999999999999);
}, 0);
},
onClose: function (date, datepicker) {
datepicker.input.valid();
}
});

And when i select a date with +100 years or - 100 years such as 05/24/2123 manually as an example ,the year 1921 is auto selected on my html input to 1921

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

Start by reproducing the issue with the provided DatePicker configuration and its yearRange of "-100:+100". Inspect the datepicker selection behavior for dates such as 05/24/2123 and verify that selecting dates at either range boundary preserves the selected year in the HTML input.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.