Open mdiluz opened 2 years ago
@mdiluz This will preserve the milliseconds.
decimal doubleTimestamp = Decimal.Parse(response.ts);
long longTimestamp = (long)(doubleTimestamp * 10000000m);
DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
return unixEpoch.AddTicks(longTimestamp);
There are other APIs (such as GetConversationsHistoryAsync
) that return timestamps as DateTime
, maybe we can consider changing PostMessageAsync
to return DateTime
instead?
DeleteMessageAsync for the task client seems to be written to match the one in the socket client, which understands timestamps as date times, but the API requires the timestamp as a string including microseconds.
Demonstrated in code below:
Slack needs the full
ts
string with the unique digits after the.
, not a real timestamp, so DeleteMessageAsync can't work here as I don't think you can stick the microseconds back into a DateTime (and I don't thinkToProperTimeStamp
can convert and add the.
).The workaround for now is simply to make the call manually: