Datepicker: beforeShowDay is passed wrong date when dayNamesShort are used
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.3k
- Forks
- 5.2k
- PR merge metrics
- No merged PRs in 30d
Description
Please see the demo of the issue here: https://jsfiddle.net/ea8utdyx/
Here are the steps to reproduce the problem:
- Use a nonstandard date format, like 'D M d yy'
- Pass dayNamesShort, example: dayNamesShort: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
- Pass a callback function to beforeShowDay argument
Notice that the date which is passed to the beforeShowDay callback is incorrect, it's about 6 years in the future. As a result, we cannot determine if a date should be visible or not.
In the demo, I have added console.log, which in the callback, you can check that it doesn't log the correct date.

I notice the problem doesn't happen when we comment the dayNamesShort argument.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue in the linked JSFiddle using a nonstandard date format, dayNamesShort, and a beforeShowDay callback. Trace how the date is constructed before the callback runs, then verify that the callback receives the correct calendar date and that the reproduction no longer shows the six-year offset.
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