intercom-dotnet icon indicating copy to clipboard operation
intercom-dotnet copied to clipboard

Use DateTimeOffset Instead of Int64/long for Dates

Open DotJoshJohnson opened this issue 7 years ago • 3 comments

I've found myself adding helper classes to convert the UNIX timestamps in the Intercom models to DateTime objects for use with our business logic. This PR changes all Int64/long implementations in the models to DateTimeOffset (or DateTimeOffset? where applicable) and implements a JsonConverter to ensure dates are always represented as UNIX timestamps in UTC when serialized to JSON for the API.

If this PR doesn't align with the direction of the project, feel free to simply close it. I just wanted to share in case anyone found it useful. Thanks!

DotJoshJohnson avatar Apr 30 '18 15:04 DotJoshJohnson

I’ve had to do the same thing all the time. This is a great update to take.

edblankenship avatar Apr 30 '18 15:04 edblankenship

Just as an FYI, I've run into a couple of bugs with these changes that I'm working through now. I'll push any changes here and advise when everything is working properly.

DotJoshJohnson avatar May 01 '18 18:05 DotJoshJohnson

No worries! I've actually gotten sidetracked with other priorities myself. I'll jump back in here as soon as I can to get these changes in place. Thanks for the consideration!

DotJoshJohnson avatar Jun 16 '18 02:06 DotJoshJohnson

@DotJoshJohnson no rush at all. Thank you once again. 🙇

kmossco avatar Jun 16 '18 10:06 kmossco