NodaTime YearMonth mapping
See original GitHub issueIt would be nice to have a NodaTime YearMonth
mapping, despite the fact that PostgreSQL doesn’t have a specific type for it. It could be stored as a date (rounded to the first day of the month) or perhaps as an integer the way NodaTime internally stores it.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Noda Time | Patterns for YearMonth values
A mapping is provided between "year within era" and "absolute" year - where an absolute year uniquely identifies the date, and does not...
Read more >Date/Time Mapping with NodaTime
NodaTime defines some types which are missing from the BCL, such as LocalDate , LocalTime , and OffsetTime . These cleanly correspond to...
Read more >How do I correcly handle ZoneLocalMapping.ResultType. ...
throws an InvalidOperationException with message "EarlierMapping property should not be called on a result of type Ambiguous". I have no clue ...
Read more >Noda Time | Jon Skeet's coding blog | Page 2
So, Noda Time exposes four ways of mapping a LocalDateTime and DateTimeZone to a ZonedDateTime: Exact: if there's a single mapping, return it....
Read more >Noda Time: An Advanced Date/Time Library for .NET - InfoQ
The YearMonth subclass is useful for things like credit card expiration dates where defaulting to the first or last of the month may...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I revisited the project where I needed this today. I thought a
ValueConverter
wouldn’t result in proper SQL translation, but it does actually work very well:All parameters/comparisons/conversions just get treated like a PostgreSQL
date
. It will break down if I start to need more complicated translations, but this works great for now.Thanks for the help.
Happy it worked out and thanks for the code snippet.