You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Side note: I realize there are reasons this functions like this, however perhaps it should be made more clear in the documentation how the internals work. You apparently cannot simply provide 2 dates and get the humanized value unless the dates are either UTC or Local (local meaning server's time by default). Providing DateTimes that coincide with a time zone other than UTC or Local produce unexpected results.
DateTime.ToLocalTime uses the DateTimeKind to determine if the date needs to be converted at all. I think you may be able to work around the weird behaviour by using DateTime.SpecifyKind.
I'm attempting to humanize a date in the local (to the user) time zone.
var localTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, usersLocalTimeZone)
localTime .Humanize(false, localNow)
After reviewing the source code it seems that is because the
dateToCompareAgainst
in is always converted eitherToUniversalTime()
orToLocalTime()
What is the best course of action to supply 2 dates in any like-timezone and get the the time between them?
The text was updated successfully, but these errors were encountered: