Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue while selecting previous month date from FEBRUARY. #852

Open
meetsiddharth opened this issue Feb 8, 2023 · 14 comments
Open

Issue while selecting previous month date from FEBRUARY. #852

meetsiddharth opened this issue Feb 8, 2023 · 14 comments

Comments

@meetsiddharth
Copy link

meetsiddharth commented Feb 8, 2023

I'm Submitting a ...

[x] Bug report
[ ] Feature request
[ ] Support request

Steps to Reproduce

Selecting previous month dates from February is giving wrong date.

  1. Go to Feb of any year.
  2. Select 29,30,31 or available dates of january.
  3. selecting 31 january will give 3 jaunary.

image

Expected Results

On clicking on 31 jaunary from February month should give 31 January as date.

Actual Results

On clicking on 31 jaunary from February month it is giving 3 January as date.

Minimal Reproduction of the Problem

can check here - https://codesandbox.io/s/boring-dew-uzln3

  1. Go to Feb of any year.
  2. Select 29,30,31 (previous month dates) or available dates of january.
  3. selecting 31 january will give 3 jaunary.
  4. selecting 30 january will give 2 january.

Other Information (e.g. stacktraces, related issues, suggestions how to fix)

@meetsiddharth meetsiddharth changed the title Issue while selecting previous months date from FEBRUARY. Issue while selecting previous month date from FEBRUARY. Feb 8, 2023
ManishManda pushed a commit to ManishManda/react-datetime that referenced this issue Feb 13, 2023
ManishManda pushed a commit to ManishManda/react-datetime that referenced this issue Feb 13, 2023
@ManishManda
Copy link

ManishManda commented Feb 13, 2023

Hi @arqex Raised PR for this issue , KIndly review the changes

#854

@jrussak
Copy link

jrussak commented Feb 20, 2023

This seems not to be specific to February but happens when previous month has more days than the current one.
It won't work for the days that are greater than the max day in current month so the issue can also be reproduced for other months.

Example:

  • Go to April of any year
  • Select 31 March
  • Selecting 31 March will give first of March
  • Will work for all the days that are <= than the max day in current month.

@ManishManda
Copy link

I have raised pull request for this , i hope this solves the above issue you mentioned, for all months also
#854

@JensDebergh
Copy link

We're experiencing the same issue here. First time in 4 years (using this library) one of our users reported this. Amazing how easily these things get overlooked.

Can we get this fix merged? 🙏

@jrussak
Copy link

jrussak commented May 3, 2023

Do you have any updates on this?

@ManishManda
Copy link

still not yet merged @jrussak ,can we get this merged @arqex ?

@WizardCM
Copy link

WizardCM commented Jun 1, 2023

Also ran into this today. If the default is the current day (1st June) and then May 31st is selected, it resets to May 1st. Re-selecting May 31st again works as the month lengths match.

@abdulrahman-centroid
Copy link

Hi there, I wanted to check in about the ongoing issue. Do you have any updates on when it might be resolved? Thank you.

@jrussak
Copy link

jrussak commented Dec 18, 2023

Is it possible to merge this?

@prasunk96
Copy link

prasunk96 commented Jan 2, 2024

Faced the exact same issue. If we try to select previous months last day from current months view it would select the first day of the previous month instead of selecting the last day.
Eg:

  • If we are in september month view
  • and If i select 31st august from september month view (which is actually visible in the september month view)
  • It would select 1st of August instead of selecting 31st.

The issue seem to be happening for month combinations where the current month view has less days that previous month.
for eg - (current view month) -> september(30) - (previous month whos last day is visible in september view) -> august(31)

I checked the pr raised by @ManishManda and the changes seems to be correct because the underlying issue is if we change the day before chaning the month this secnario would happend.

Can we get the PR merge and have fix published?
@arqex

@TrekSoft
Copy link

TrekSoft commented Feb 7, 2024

Encountering this as well - I see the repo hasn't been maintained for a year now. Has anyone created a fork with this fix in it?

@lukezavrel
Copy link

I have rewritten the workaround from #848 (comment) a little, maybe it will help someone https://codesandbox.io/p/sandbox/trusting-hertz-lddqcs?file=%2Fsrc%2FApp.js

@yuan9090
Copy link

I fork the repository and fix this issue. Try https://www.npmjs.com/package/@iftek/react-datetime

@noxxxxxxxx
Copy link

complete rewrite this package with react 18, and fix this issue

https://github.com/noxxxxxxxx/calendar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests