Timezone Issue in Media Gallery

I have my community set to Eastern time in Control Panel

A user with CST as their timezone uploads a file.

Another user with CST as their timezone views the media item

The $media.Date shows a timezone offset of -04:00 when rendered, but the time shows as UTC time

The time that displays to both users is 5 hours different than when they uploaded it.  Appears to be rendering the UTC time.  I was wondering if this is expected behavior or how I am supposed to show the actual upload time in the user's timezone to the user.

We have a protected gallery that users are uploading files to...these files have deadlines and our admins are looking at these timestamps ont he media items to determine if they met the deadlines or not.

Parents
  • Has this been customized in any way?  The APIs will always return data in the accessing users timezone unless you potentially have widget code double adjusting.

  • No, it has not been adjusted at all.  It appears to be returning the same timestamp from the database, but with an EST timezone offset attached.

    For instance, in the DB I have: 
    2019-07-09 13:01:52.370

    When I get the date from the media object it has the exact same date/time that is in the DB, but it also has a -04:00 offset which I believe is EST - Like the system is attaching a timezone but not altering the time of the date.

    I'm on version 9.0 and pushing it through this method gave me the correct time.

                public DateTime ToUserTimezone(DateTime date, Telligent.Evolution.Extensibility.Api.Entities.Version1.User user)
                {
                    var newDate = DateTime.SpecifyKind(date, DateTimeKind.Utc);
                    return TimeZoneInfo.ConvertTime(newDate, TimeZoneInfo.FromSerializedString(user.TimeZoneInfo));
                }

Reply Children