-
-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support DateOnly
and TimeOnly
fields
#320
Comments
Do we want to add this support before we release? Its potentially a breaking change. |
While it would be cool, I don't have the capacity to do this in the short term. I think we get a release out with S.T.J now and plan out exactly how we add support for these structs (whether we go with my suggestion above about intermediary structs). |
I'm not sure it'd be that much work. I'll see if I can get to it. https://schema.org/Date -> DateOnly |
My thought was something like: public struct SchemaDate
{
#if NET_6_OR_GREATER
private DateOnly BackingDate;
public static implicit operator DateOnly(SchemaDate schemaDate) { /* ... */ }
public static implicit operator SchemaDate(DateOnly date) { /* ... */ }
#else
private DateTime BackingDate;
#endif
public static implicit operator DateTime(SchemaDate schemaDate) { /* ... */ }
public static implicit operator SchemaDate(DateTime date) { /* ... */ }
} And then something similar for the If we switch out What are your thoughts on that? |
I was hoping it'd be one or two simple if statements with an |
Here are my quick thoughts for the scope of what I think would need changing/issues you might hit... I think these places at minimum would need changing:
I don't know if the source generator is aware what the target framework is as it is a .NET Standard library so Happy to be a sounding board if you run into issues trying to add these types though! |
Originally posted by @Turnerj in #100 (comment)
The text was updated successfully, but these errors were encountered: