Skip to content

Convert.ChangeType does not work with DateOnly #73074

@MgSam

Description

@MgSam

Description

System.Convert.ChangeType does not work converting System.String to System.DateOnly. I would expect it to work given that it does work for System.String to System.DateTime.

Reproduction Steps

Convert.ChangeType("1/1/2000", typeof(DateTime)); //Works
Convert.ChangeType("1/1/2000", typeof(DateOnly)); //InvalidCastException

Expected behavior

System.Convert.ChangeType should work for String -> DateOnly

Actual behavior

System.Convert.ChangeType does not work for String -> DateOnly

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.DateTimedocumentationDocumentation bug or enhancement, does not impact product or test code

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions