-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
fix: Inconsistent/broken behavior in parseDate
#5036
base: main
Are you sure you want to change the base?
Commits on Aug 15, 2024
-
tests: Add failing locale test: bad value is parsed using default locale
Parsing `valueEn` as a Portugese date should fail, but accidentally gets parsed using the default/en-US locale, because parseDate internally retries and accidentally omits[^1] the original locale option that time around. [^1]: https://github.com/Hacker0x01/react-datepicker/blob/5c1d6d923931535f105f3dddbb6f3e10fd8dd25c/src/date_utils.js#L121
Configuration menu - View commit details
-
Copy full SHA for 883353c - Browse repository at this point
Copy the full SHA 883353cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 16b9c94 - Browse repository at this point
Copy the full SHA 16b9c94View commit details -
tests: Fix side-effecty+inconsistent formatting of date value inputs
…making sure input values are applied in a more consistent manner, and with formatting that matches the currently active dateFormat (usually the default format). This only affects clarity/readability. All tests still pass.
Configuration menu - View commit details
-
Copy full SHA for 6dfbbe6 - Browse repository at this point
Copy the full SHA 6dfbbe6View commit details
Commits on Aug 16, 2024
-
fix:
parseDate
should prefer the first matching format in arrayFix involves vastly simplifying the internal code-paths of `parseDate`, to prevent further and repeated divergence of behavior when parsing `dateFormat` as `Array<string>` vs. as `string` NOTE: Removing the (redundant) `minDate` parameter has no effect on the tests, as minDate/maxDate boundry checks are enforced elsewhere in the component's value-updating lifecycle. NOTE 2: Adding instead `refDate` (using `props.selected`) to fully utilize the features of `date-fns/parse`. NOTE 3: The old behavior of re-parsing borked values using `new Date()` was somewhat dubious as it gave different results depending on the Browser/OS running the code. See more here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date#parameters
Configuration menu - View commit details
-
Copy full SHA for e4ed031 - Browse repository at this point
Copy the full SHA e4ed031View commit details
Commits on Aug 17, 2024
-
fix: initialize param with default argument
Initialize refDate with newDate() as a default argument. Suggested by @pullrequest @buu700.
Configuration menu - View commit details
-
Copy full SHA for e80b0e7 - Browse repository at this point
Copy the full SHA e80b0e7View commit details
Commits on Aug 29, 2024
-
Merge branch 'main' into pr-3988-rebase-v3
* main: (40 commits) chore(deps-dev): bump axe-core from 4.9.1 to 4.10.0 chore(deps-dev): bump @typescript-eslint/eslint-plugin chore(deps): bump micromatch from 4.0.7 to 4.0.8 chore(deps): bump webpack from 5.88.1 to 5.94.0 in /examples/hello-world chore(deps): bump webpack from 5.88.1 to 5.94.0 in /docs-site chore(deps): bump micromatch from 4.0.5 to 4.0.8 in /docs-site chore(deps): bump micromatch in /examples/hello-world chore(deps-dev): bump rollup from 4.19.0 to 4.21.1 🧪✅ Add test cases for safeQuerySelector, safeQuerySelectorAll, and SafeElementWrapper ♻️ Update a calendar_test test case to use SafeQuerySelector chain to avoid a temporary variable usage ✨ Add SafeElementWrapper utility to support safe query selection chain to avoid unnecessary temporary variables ♻️ Refactor the usage of safeQuerySelectorAll to also pass the required no of elements and remove the redundant throw error logic ♻️ Update the safeQuerySelectorAll helper to throw an error if the found element is less than the minExpected param ♻️ Refactor safeQuerySelector not toBe null test block to notThrow as the safeQuerySelector automatically throws an error if the element is not found ♻️ Remove the redundant check of the safeQuerySelector result to not be null fix: onSelect and onClickOutside are not optional Refactor: simplify calls to setOpen prop Refactor: simplify calls to remaining event handler props Refactor: simplify calls to onMonthChange handler Refactor: simplify calls to optional onSelect handler ...
Configuration menu - View commit details
-
Copy full SHA for 63e2239 - Browse repository at this point
Copy the full SHA 63e2239View commit details
Commits on Aug 30, 2024
-
Merge branch 'main' into pr-3988-rebase-v3
* main: test: cover early return cases feat: support parsing of date range strings chore(deps-dev): bump stylelint from 16.7.0 to 16.9.0 test: parse date range chore(deps-dev): bump @types/node from 22.5.0 to 22.5.1 chore(deps-dev): bump lint-staged from 15.2.7 to 15.2.9 chore(deps-dev): bump eslint-plugin-unused-imports from 3.2.0 to 4.1.3
Configuration menu - View commit details
-
Copy full SHA for 053b403 - Browse repository at this point
Copy the full SHA 053b403View commit details -
fix: remove unneeded code to prevent date change with `showTimeSelect…
…Only` Before this PR, the below function calls: `index.tsx:handleChange -> date_utils:parseDate -> date-fns:parse` were passing `new Date()` to date-fns parse function as the 'reference date' parameter. This meant that when the datepicker had the `showTimeSelectOnly` prop and the date format was just a time (e.g. H:mm) the parse result's year/month/day would be today instead of the previously selected date, which we want. To prevent this problem, the block of code being removed in the present commit would take the current selected date and reset the time to the newly input/parsed time, so that as a result, the year/month/day would not change. Instead, this PR fixes the problem at its root, by passing `this.props.selected` instead of `new Date()` to the date-fns `parse` function as the reference date, such that the parse result of just a time string will have the same year/month/day as `this.props.selected`. This is the desired behavior, and so this block of code is no longer needed. This is already tested in test "when update the datepicker input text while props.showTimeSelectOnly is set and dateFormat has only time related format".
Configuration menu - View commit details
-
Copy full SHA for e9fe0bf - Browse repository at this point
Copy the full SHA e9fe0bfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9eee52d - Browse repository at this point
Copy the full SHA 9eee52dView commit details
Commits on Sep 1, 2024
-
Merge branch 'main' into pr-3988-rebase-v3
* main: fix: migrate to husky 9 fix: remove postcss fix: remove unnecessary change fix: remove install-state.gz files fix: prettier error and some minor updates chore: update deps chore: update deps chore: upgrade deps chore: upgrade dependencies fix: test failures chore: upgrade babel fix: docs-site needs to store yarn installation fix: workflow should use yarn 4 not 1 chore: upgrade yarn to v4 and other dependencies
Configuration menu - View commit details
-
Copy full SHA for 0ba1294 - Browse repository at this point
Copy the full SHA 0ba1294View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6ccd449 - Browse repository at this point
Copy the full SHA 6ccd449View commit details
Commits on Sep 2, 2024
-
Merge branch 'main' into pr-3988-rebase-v3
* main: chore(deps-dev): bump husky from 9.1.3 to 9.1.5 chore(deps-dev): bump @babel/helpers from 7.25.0 to 7.25.6 chore(deps-dev): bump eslint-plugin-jest from 28.8.0 to 28.8.1 ♻️🧪 Refactor test with SafeElementWrapper and removed the direct usage of safeQuerySelector/safeQuerySelectorAll to avoid unnecessary intermediate variable declarations
Configuration menu - View commit details
-
Copy full SHA for 1152459 - Browse repository at this point
Copy the full SHA 1152459View commit details -
Merge branch 'main' into pr-3988-rebase-v3
* main: test: fix a test that would always fail if run on first day of month
Configuration menu - View commit details
-
Copy full SHA for c4323b3 - Browse repository at this point
Copy the full SHA c4323b3View commit details
Commits on Sep 4, 2024
-
Configuration menu - View commit details
-
Copy full SHA for b34bfb2 - Browse repository at this point
Copy the full SHA b34bfb2View commit details
Commits on Oct 4, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 3e1733e - Browse repository at this point
Copy the full SHA 3e1733eView commit details
Commits on Oct 22, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 4068262 - Browse repository at this point
Copy the full SHA 4068262View commit details