intercom / intercom-dotnet

Intercom API client library for .NET
https://developers.intercom.io/reference
Apache License 2.0
63 stars 53 forks source link

Use DateTimeOffset Instead of Int64/long for Dates #119

Open DotJoshJohnson opened 6 years ago

DotJoshJohnson commented 6 years ago

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!

EdBlankenship commented 6 years ago

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

DotJoshJohnson commented 6 years ago

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 commented 6 years ago

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!

kmossco commented 6 years ago

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