Closed welshdave closed 5 years ago
Looking good. Will take a proper look tomorrow. Thanks!
This is up to you but I see a few comments here about some TypeConverters not working in certain circumstances and would like to expand the tests a bit to ensure that we can convert those. If you want to take a look let me know or I'll merge then take a look and fix any issues if they exist https://www.hanselman.com/blog/TypeConvertersTheresNotEnoughTypeDescripterGetConverterInTheWorld.aspx
Wouldn't be able to look for a few days (travelling in to office to prove I still exist), but could look Thursday or Friday?
Cool!
On Mon, 15 Jul 2019 at 09:24, Dave Lewis notifications@github.com wrote:
Wouldn't be able to look for a few days (travelling in to office to prove I still exist), but could look Thursday or Friday?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CarterCommunity/Carter/pull/199?email_source=notifications&email_token=AAAZVJRCGZJHJHEYOWAV2M3P7QX23A5CNFSM4IDRZZXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ5AM3Y#issuecomment-511313519, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAZVJSO7EZMTG5II4GBAZDP7QX23ANCNFSM4IDRZZXA .
So TypeConverters have a few problems - don't think it's worth using them. I've updated and added a few more tests.
What was the issues with them?
They lose precision when converting datetime (loses milliseconds), seem to be a lot more picky about date formatting than other conversion methods.
And for number formatting, strings like "1,234.00" don't convert (try converting that to a decimal, it fails with the TypeConverter approach, works fine with Convert.ChangeType).
Is it worth adding some tests for decimals?
Yeah, I'll add some now
Thanks @welshdave Awesome stuff!
Fixes #198