-
-
Notifications
You must be signed in to change notification settings - Fork 329
feat(luxon-getNow): Improve the response tz
setting for obtaining the current time method
#883
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
feat(luxon-getNow): Improve the response tz
setting for obtaining the current time method
#883
Conversation
…he current time method
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough该拉取请求对 Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #883 +/- ##
=======================================
Coverage 95.43% 95.43%
=======================================
Files 64 64
Lines 2716 2717 +1
Branches 755 732 -23
=======================================
+ Hits 2592 2593 +1
Misses 121 121
Partials 3 3 ☔ View full report in Codecov by Sentry. |
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: 0
🧹 Outside diff range and nitpick comments (1)
src/generate/luxon.ts (1)
60-67
: 更改看起来不错,建议稍微改进注释这个更改解决了与时区设置相关的问题,符合PR的目标。使用
DateTime.now()
而不是DateTime.local()
可以确保正确响应全局时区设置。建议稍微修改注释,使其更加明确:
/** - * The current time that can respond to tz settings is required. like `dayjs().tz()`. + * Use DateTime.now() to get the current time that respects global timezone settings. + * This change ensures consistency with other libraries like dayjs().tz(). * @see: https://github.com/ant-design/ant-design/issues/51282 * https://github.com/react-component/picker/pull/878 */这个修改可以更清楚地解释为什么使用
DateTime.now()
,以及它如何解决时区问题。
fix: ant-design/ant-design#51282
看起来和之前解决 #878 问题一样
DateTime.local()
方法只会应用 system 的 tz, 需要使用toLocal()
来应用本地设置的 timezone。默认不传递即生效Settings.defaultZone
设置的值。DateTime.now()
会直接返回应用了 tz 的本地时间Summary by CodeRabbit
DateTime.now()
的必要性。