-
-
Notifications
You must be signed in to change notification settings - Fork 337
feat: Use internal dayjs instance to avoid implicit dependency on pl… #958
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
base: master
Are you sure you want to change the base?
Conversation
…gins extended by external dayjs versions
|
Someone is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello @1o1w1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a stability issue in Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Walkthrough在 Changes
Sequence Diagram(s)(已省略 — 变更为单文件内部规范化,未引入跨组件新交互) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Suggested reviewers
诗句
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request aims to isolate the internal Day.js instance to prevent plugin conflicts when multiple versions of the library are present, by wrapping date operations with a getUDayjs utility function. However, a critical data integrity bug was introduced in the conversion logic between external and internal Day.js instances. Specifically, the use of .unix() (seconds) with the dayjs() constructor (milliseconds) causes dates to be incorrectly shifted to 1970, leading to incorrect date conversions. This issue needs to be addressed for correct date processing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/generate/dayjs.ts`:
- Around line 111-118: getUDayjs incorrectly calls dayjs(value.unix()) which
treats the number as milliseconds while unix() returns seconds, producing wrong
dates for external Dayjs instances; update the conversion to use seconds-aware
parsing by replacing dayjs(value.unix()) with either dayjs.unix(value.unix()) or
dayjs(value.unix() * 1000) so external Dayjs values are converted to the
internal dayjs instance with the correct timestamp (refer to getUDayjs, dayjs,
and value.unix()).
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/generate/dayjs.ts`:
- Line 2: The import of isDayjs from 'dayjs' is not compatible with dayjs v1.x;
update code in src/generate/dayjs.ts to stop using the named import and instead
call the static helper on the default import: replace uses of the named symbol
isDayjs with dayjs.isDayjs(value) (and remove "import { isDayjs } from
'dayjs'"), ensuring checks like "dayjs.isDayjs(value)" and any instanceof checks
use the dayjs default export; alternatively note you can upgrade to dayjs v2.x
if you prefer to keep named imports.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #958 +/- ##
=======================================
Coverage 98.80% 98.80%
=======================================
Files 65 65
Lines 2680 2684 +4
Branches 719 745 +26
=======================================
+ Hits 2648 2652 +4
Misses 29 29
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Test cases have been added |

Hi,
This PR addresses the issue where rc-picker crashes when multiple Day.js versions are present due to an implicit dependency on plugins registered on the external Day.js instance.
To fix this, I’ve updated the component to use its own internal Day.js instance with all required plugins explicitly extended. This ensures consistent behavior regardless of the Day.js version or plugin setup in the host app.
The change is non-breaking and has been verified against the provided reproduction case — the RangePicker now works as expected.
For more details, please see: #957
Thanks for your time reviewing!
Summary by CodeRabbit
发布说明