Skip to content

DateTime to TimeOnly conversion always returns zero #9075

@ssimek

Description

@ssimek

Product

Hot Chocolate

Version

15.1.12

Link to minimal reproduction

registry.Register<DateTime, TimeOnly>(from => TimeOnly.FromDateTime(from.Date));

Steps to reproduce

Sorry for using a link to the repo itself, but it's much easier to look at the code than to create a project reproducing this. As you can see in the linked line (and L86 above), the TimeOnly is constructed from the Date part of the datetime, which will invariably return zero.

What is expected?

Time part of the DateTime(Offset) is returned

What is actually happening?

Zero time is returned all the time

Relevant log output

Additional context

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions