Skip to content

Conversation

@simonguo
Copy link
Member

Add calendarKey to renderTitle

<DateRangePicker
  renderTitle={(date: Date, calendarKey: 'start' | 'end') => {
    if (calendarKey === 'start') {
      return 'Start Calendar';
    }
    return 'End Calendar';
  }}
/>

#4313

@simonguo simonguo requested a review from Copilot June 19, 2025 02:50
@codesandbox
Copy link

codesandbox bot commented Jun 19, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new calendarKey prop to the renderTitle function of the DateRangePicker component, allowing the title to be rendered differently for the start and end calendars.

  • Updated the renderTitle prop type in both DateRangePicker and Calendar components
  • Added a new test case to verify proper rendering of calendar titles with start and end keys
  • Updated documentation for both English and Chinese versions to reflect the new API

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/DateRangePicker/test/DateRangePickerSpec.tsx Added test verifying renderTitle output based on calendarKey
src/DateRangePicker/DateRangePicker.tsx Updated renderTitle signature to include calendarKey
src/DateRangePicker/Calendar.tsx Integrated calendarKey logic and updated renderTitle callback
docs/pages/components/date-range-picker/zh-CN/index.md Updated documentation for renderTitle with calendarKey parameter
docs/pages/components/date-range-picker/en-US/index.md Updated documentation for renderTitle with calendarKey parameter

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@codecov
Copy link

codecov bot commented Jun 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.21%. Comparing base (9715633) to head (d5732ae).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4318   +/-   ##
=======================================
  Coverage   89.20%   89.21%           
=======================================
  Files         528      528           
  Lines       12548    12550    +2     
  Branches     3216     3216           
=======================================
+ Hits        11194    11196    +2     
  Misses        677      677           
  Partials      677      677           
Flag Coverage Δ
ChromeCi 89.15% <100.00%> (+<0.01%) ⬆️
Firefox 89.13% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@simonguo simonguo merged commit 5b8c198 into main Jun 19, 2025
16 checks passed
@simonguo simonguo deleted the feature/daterangepicker-rendertitle-calendarkey branch June 19, 2025 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants