Closed MichaelLiss closed 3 months ago
Dates in JavaScript, upon stringification, are represented as ISO timestamps. 2024-04-04 5:59 in London is 2024-04-03 23:59 your time.
Dates in JavaScript, upon stringification, are represented as ISO timestamps. 2024-04-04 5:59 in London is 2024-04-03 23:59 your time.
Hi...
I think that if there is a calendar control that deals with dates .. .the hours - minutes - seconds should not matter.
The control does not have a "time" specified of the day you wish to start... it merely gives dates - I am selecting a date range from 1 Apr 2024 to 3 Apr 2024 - the date range returned should be 1 Apr 2024 to 3 Apr 2024.
The 'disabled' dates do not suggest an hours/minutes/seconds: const disabledDates = ['3-22-2024'];
additionally, the function that sets the 'range of valid dates' ( in my example code addMonthsToDate
) does not take into account hours/minutes/seconds
so I am confused the control deals with years/months/days in some aspects and hours/minutes/seconds in others
Before you start - checklist
Description
here is my code react code
Steps to reproduce
I clicked on 1 Apr 2024 and then extended selection to 3 Apr 2024 and clicked on 3 Apr 2024
Expected behavior
I would expect the selected dates to be 1 Apr 2024 to 3 Apr 2024
Actual behavior
const [selectedDates, setSelectedDates] = useState(new Date());
selectedDates
is 1 Apr 2024 to 4 Apr 2024Additional information
Environment
here are all my dependencies
"dependencies": { "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "axios": "^1.6.2", "axios-jwt": "^3.0.0", "date-fns": "^3.4.0", "react": "^18.2.0", "react-calendar": "^4.8.0", "react-dom": "^18.2.0", "react-images-uploading": "^3.1.7", "react-router-dom": "^6.20.1", "react-scripts": "5.0.1", "web-vitals": "^2.1.4" },