Skip to content

Comments

fix(date-panel): 修复日期面板日期模式计算错误和样式相关的问题#4042

Open
Rndlab wants to merge 1 commit intoopentiny:devfrom
Rndlab:dev
Open

fix(date-panel): 修复日期面板日期模式计算错误和样式相关的问题#4042
Rndlab wants to merge 1 commit intoopentiny:devfrom
Rndlab:dev

Conversation

@Rndlab
Copy link

@Rndlab Rndlab commented Jan 30, 2026

PR

· 修复日期面板中日期计算错误,现有日期选择模式存在高亮日期比选择日期多一天的问题。

· 调整日期表格单元格顶部间距从4px改为3px,处理选中日期位置错位问题:
修复前
d85c5866-6258-4033-a48b-d4947184baf6
修复后
0e9b53c1-f9ed-4199-bb76-3de1fce647a6

· 修正文档中基础用法示例中月份和年份面板的v-model绑定错误

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Bug Fixes

    • Fixed data bindings for month and year selections in date panel components to properly reflect user input.
    • Corrected UTC date offset calculation in date panel processing.
  • Style

    • Adjusted date-table cell top spacing for improved visual alignment.

✏️ Tip: You can customize this high-level summary in your review settings.

修复日期面板中日期计算错误,将UTCDate+1改为直接使用UTCDate
调整日期表格单元格顶部间距从4px改为3px
修正基础用法示例中月份和年份面板的v-model绑定错误
@github-actions github-actions bot added the bug Something isn't working label Jan 30, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

Walkthrough

Updated v-model bindings in date-panel demo from value to month/year properties, removed a +1 offset from UTC date calculation in renderless date-panel logic, and reduced CSS top spacing for date-table cell spans from 4px to 3px.

Changes

Cohort / File(s) Summary
Date-Panel Demo
examples/sites/demos/pc/app/date-panel/basic-usage.vue
Updated v-model bindings from value to month and year for month-type and year-type TinyDatePanel instances.
Date-Panel Logic
packages/renderless/src/date-panel/vue.ts
Removed +1 offset from UTC date calculation in modelValue change handler for newDate computation.
Date-Table Styling
packages/theme/src/date-table/vars.less
Reduced CSS variable --tv-DateTable-td-span-top from 4px to 3px for date-table cell span top spacing.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A panel picks the perfect date,
With month and year in proper state,
One pixel less, the spacing flows,
No offset tricks—just how it goes!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title describes date panel bug fixes including calculation errors and style issues, which aligns with the changeset containing corrections to date calculation logic, CSS spacing adjustment, and v-model binding fixes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

}
if (newVal) {
const newDate = modifyDate(newVal, newVal.getFullYear(), newVal.getMonth(), newVal.getUTCDate() + 1)
const newDate = modifyDate(newVal, newVal.getFullYear(), newVal.getMonth(), newVal.getUTCDate())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样在某些情况下会导致选中日期提前一天,可将getUTCDate 修改为getDate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants