-
Notifications
You must be signed in to change notification settings - Fork 23
Use explicit subconverters for [NodaTimeDefaultJsonConverter] for Interval and DateInterval #136
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ private static Dictionary<Type, JsonConverter> CreateConverterDictionary() | |
| Add(NodaConverters.AnnualDateConverter); | ||
| Add(NodaConverters.DurationConverterImpl); | ||
| Add(NodaConverters.InstantConverter); | ||
| Add(NodaConverters.IntervalConverter); | ||
| Add(new NodaIntervalConverter(NodaConverters.InstantConverter)); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I must admit that I'm not entirely following this change, but should this change be made to the (That would also obviate the need for two separate constructors for
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so - because if someone creates a set of options and specifies a non-default Instant converter (e.g. |
||
| Add(NodaConverters.LocalDateConverter); | ||
| Add(NodaConverters.LocalDateTimeConverter); | ||
| Add(NodaConverters.LocalTimeConverter); | ||
|
|
@@ -51,7 +51,7 @@ private static Dictionary<Type, JsonConverter> CreateConverterDictionary() | |
| Add(NodaConverters.CreateZonedDateTimeConverter(DateTimeZoneProviders.Tzdb)); | ||
|
|
||
| // Reference types | ||
| converters[typeof(DateInterval)] = NodaConverters.DateIntervalConverter; | ||
| converters[typeof(DateInterval)] = new NodaDateIntervalConverter(NodaConverters.LocalDateConverter); | ||
| converters[typeof(DateTimeZone)] = NodaConverters.CreateDateTimeZoneConverter(DateTimeZoneProviders.Tzdb); | ||
| converters[typeof(Period)] = NodaConverters.RoundtripPeriodConverter; | ||
| return converters; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I'm surprised this doesn't need to be declared as nullable; but also later I'm also asking if we need to accept null here.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not using nullable reference types in this project yet. (I should probably do so at some point.)