Skip to content

feat(DateTimePicker): rename ParseDateTimeResolve to ParseDateTimeCallback - #8304

Merged
ArgoZhang merged 18 commits into
mainfrom
doc-dtm
Aug 6, 2026
Merged

feat(DateTimePicker): rename ParseDateTimeResolve to ParseDateTimeCallback#8304
ArgoZhang merged 18 commits into
mainfrom
doc-dtm

Conversation

@ArgoZhang

@ArgoZhang ArgoZhang commented Aug 6, 2026

Copy link
Copy Markdown
Member

Link issues

fixes #8303

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Rename DateTime parsing customization hooks to use Callback naming, make DateTimeHelper public with improved XML documentation, and update related usage, documentation, and tests.

New Features:

  • Expose DateTimeHelper as a public utility for date and time parsing and conversion.
  • Introduce configurable DateTimeSettings parsing callbacks for DateTime and DateTimeOffset in global options and demos.

Enhancements:

  • Rename DateTimePicker and DateTimeSettings parsing delegates from Resolve to Callback for clearer semantics and consistency.
  • Simplify DateTimeHelper unit tests by removing unsafe accessors and calling the helper methods directly.
  • Add localized documentation and demo content explaining DateTimeSettings and custom parsing callbacks.
  • Extend DateTime demo to show using ParseDateTimeCallback for custom editable parsing behavior.

Tests:

  • Adjust DateTimePicker and DateTimeHelper tests to reflect the new public helper and renamed callback properties.

@bb-auto bb-auto Bot added the enhancement New feature or request label Aug 6, 2026
@bb-auto bb-auto Bot added this to the v10.9.0 milestone Aug 6, 2026
@sourcery-ai

sourcery-ai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Renames the DateTimePicker parsing delegates from *Resolve to *Callback across component, options, samples, and tests, while making DateTimeHelper public with improved XML docs and simplifying its unit tests to call it directly, plus adding documentation and localization entries for new DateTimeSettings options and editable parsing demo.

Sequence diagram for DateTimePicker parsing with ParseDateTimeCallback

sequenceDiagram
    actor User
    participant DateTimePicker
    participant DateTimeSettings
    participant DateTimeHelper

    User->>DateTimePicker: input value
    DateTimePicker->>DateTimeSettings: Options.CurrentValue.DateTimeSettings
    DateTimePicker->>DateTimePicker: ParseDateTimeCallback
    alt [ParseDateTimeCallback != null]
        DateTimePicker->>DateTimePicker: ParseDateTimeCallback(value)
    else [ParseDateTimeCallback == null]
        DateTimePicker->>DateTimeSettings: ParseDateTimeCallback
        alt [DateTimeSettings.ParseDateTimeCallback != null]
            DateTimePicker->>DateTimeSettings: ParseDateTimeCallback(value)
        else [no callbacks]
            DateTimePicker->>DateTimeHelper: ToDateTime(value)
        end
    end
Loading

File-Level Changes

Change Details Files
Expose DateTimeHelper as a public utility with bilingual XML documentation and adjust supported compact date-time formats.
  • Change DateTimeHelper from internal static to public static to allow direct use from other assemblies and tests.
  • Enhance XML documentation for DateTimeHelper methods and parameters with both Chinese and English descriptions.
  • Modify the compact date-time format list to remove several separator-based patterns, relying on general parsing for those formats.
src/BootstrapBlazor/Utils/DateTimeHelper.cs
Simplify DateTimeHelper tests to call the helper directly instead of using UnsafeAccessor-based reflection.
  • Remove UnsafeAccessor attributes, helper type name constant, and related extern method declarations used to access internal methods.
  • Update all tests to call DateTimeHelper.ToDateTime, ToDateTime with default, TryToDateTime, and ToDateTimeOffset directly.
  • Remove now-unused System.Runtime.CompilerServices using and internal-type-specific comments.
test/UnitTest/Utils/DateTimeHelperTest.cs
Rename DateTime parsing customization hooks from ParseDateTimeResolve to ParseDateTimeCallback at component and options levels, and update tests accordingly.
  • Rename DateTimePicker component parameters ParseDateTimeResolve and ParseDateTimeOffsetResolve to ParseDateTimeCallback and ParseDateTimeOffsetCallback, updating their usage in parsing logic.
  • Change DateTimeSettings option properties from ParseDateTimeResolve/ParseDateTimeOffsetResolve to ParseDateTimeCallback/ParseDateTimeOffsetCallback and wire them into DateTimePicker parsing.
  • Update unit tests for DateTimePicker to use the new parameter and option property names for both DateTime and DateTimeOffset scenarios.
src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.cs
src/BootstrapBlazor/Options/DateTimeSettings.cs
test/UnitTest/Components/DateTimePickerTest.cs
Document and demonstrate the new DateTimeSettings callbacks and editable parsing behavior in samples and global options page.
  • Add a DateTimeSettings section to GlobalOption.razor describing ParseDateTimeCallback and ParseDateTimeOffsetCallback, including a configuration code snippet.
  • Extend the DateTimePickers IsEditable demo to show tips and usage of ParseDateTimeCallback on a DateTimePicker instance.
  • Implement a ParseDateTime helper in the DateTimePickers code-behind using DateTime.ParseExact and add required CultureInfo using directive.
  • Clear BOM artifact in GlobalOption.razor first line and adjust DateTimePicker binding to use the new callback in the sample.
src/BootstrapBlazor.Server/Components/Pages/GlobalOption.razor
src/BootstrapBlazor.Server/Components/Samples/DateTimePickers.razor
src/BootstrapBlazor.Server/Components/Samples/DateTimePickers.razor.cs
Add or update localization strings for DateTimeSettings documentation entries in both English and Chinese locales.
  • Introduce localized text keys describing DateTimeSettings, ParseDateTimeCallback, and ParseDateTimeOffsetCallback for the global options page and demos in en-US.json.
  • Provide corresponding Chinese translations for the new DateTime-related global option descriptions and demo tips in zh-CN.json.
src/BootstrapBlazor.Server/Locales/en-US.json
src/BootstrapBlazor.Server/Locales/zh-CN.json

Assessment against linked issues

Issue Objective Addressed Explanation
#8303 Rename the DateTimePicker component parameter ParseDateTimeResolve to ParseDateTimeCallback and update all internal usages and tests accordingly.
#8303 Rename the global DateTime settings options ParseDateTimeResolve/ParseDateTimeOffsetResolve to ParseDateTimeCallback/ParseDateTimeOffsetCallback and update samples and documentation references (including GlobalOption page) to use the new names.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Auto approved by bb-auto

@ArgoZhang
ArgoZhang merged commit ad269e7 into main Aug 6, 2026
5 checks passed
@ArgoZhang
ArgoZhang deleted the doc-dtm branch August 6, 2026 12:29

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Renaming the public ParseDateTimeResolve/ParseDateTimeOffsetResolve APIs to ParseDateTimeCallback/ParseDateTimeOffsetCallback is a breaking change; consider keeping the old properties as [Obsolete] shims that delegate to the new ones to avoid breaking existing consumers.
  • The removal of compact formats "yyyy-M-d" and "yyyy/M/d" from DateTimeHelper changes previously accepted input formats; if this is not intentional, restore these patterns or document clearly why they are no longer supported.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Renaming the public `ParseDateTimeResolve`/`ParseDateTimeOffsetResolve` APIs to `ParseDateTimeCallback`/`ParseDateTimeOffsetCallback` is a breaking change; consider keeping the old properties as `[Obsolete]` shims that delegate to the new ones to avoid breaking existing consumers.
- The removal of compact formats `"yyyy-M-d"` and `"yyyy/M/d"` from `DateTimeHelper` changes previously accepted input formats; if this is not intentional, restore these patterns or document clearly why they are no longer supported.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4e7bc4c) to head (6504f0b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #8304   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          771       771           
  Lines        34537     34535    -2     
=========================================
- Hits         34537     34535    -2     
Flag Coverage Δ
BB 100.00% <100.00%> (?)

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

☔ View full report in Codecov by Harness.
📢 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.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(DateTimePicker): rename ParseDateTimeResolve to ParseDateTimeCallback

1 participant