dotnet / dotnet/aspnetcore

`JsonPatchDocument.ApplyTo` should support `DateOnly` data type

Open
#40,916 4 comments 5 reactions 1 assignee Claimed by @bradygaster View on GitHub
area-minimal area-mvc area-networking feature-json-patch
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

`DateTime` works fine from JsonPatchDocument. However, `DateOnly` will not parse from a string and you can't set its year/month/day from properties so you can't build up a new object and "patch" it.

### Describe the solution you'd like

`DateOnly` should parse via JsonPatch from an ISO8601 date string that JavaScript uses.

Alternatively, even a simple `YYYY-MM-DD`.

### Additional context

The specific issue is that when sending a date string as an ISO 8601 value to be patched into a `DateOnly` object such as `2022-03-17T00:00:00.000Z` the `ApplyTo` call fails with `The value '3/17/2022 12:00:00 AM' is invalid for target location.`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.