DanDiplo / Umbraco.AuditLogViewer

An audit and content log table viewer for Umbraco CMS
https://www.diplo.co.uk/blog/web-development/diplo-audit-log-viewer-for-umbraco-10/
16 stars 7 forks source link

Content Log Viewer dates doesn't match server time #14

Open fbpenalosa opened 4 months ago

fbpenalosa commented 4 months ago

Hi @DanDiplo ,

Good morning. We've just started exploring this tool. The first thing we noticed is that the date column doesn't match the server time. For testing purposes I'm just running everything locally for now

My machine time is UTC+8

I published an article at May 01, 2024 12:24 AM

image

Content Log Viewer is showing May 01, 2024 8:24 AM instead

image

Audit Trail Logs does seem to show the proper time though.

I wonder if this is a bug.

We're using:

Umbraco CMS 12.3.6 Diplo AuditLog Viewer 10.0.1

Please let me know.

Thanks. Francis

DanDiplo commented 4 months ago

Hi. I format the date using AngularJS and I think this is down to the way that AngularJS uses your local timezone rather than the server timezone. This is a common thing with client-side libraries. Whether this is a bug or a feature, I'm not sure! It's not easy for me to test, as obviously when I run in development on my own PC the local and server timezone are the same.

fbpenalosa commented 4 months ago

Hi @DanDiplo

Thank you for the reply. I'm also just running it from my localhost for the time being so the local and server timezone are also the same. I did a bit more digging and here's what I found:

My local time is UTC+8 I saved a page today at May 02 at 6:27 PM

image

UmbracoLog table is showing it at May 02 at 5:07 PM as well

image

When I check the backoffice response, it's also returning my local time but with Z prefix:

image

I think it's treating the time from umbracoLog table as UTC and then converting it to my local time resulting to a plus 8 hour value image

This does not happen on the Audit Log Viewer because it using umbracoAudit table instead which is using actual UTC time

image

This may lead to confusion if the log time does not match the time from the Umbraco page log. I'm not sure though where this should be adjusted.

DanDiplo commented 2 months ago

I have added a tooltip now (in 10.1.0) that shows the "raw" date when you hover over the date, so see if this shows the correct time for you? If it does, then I'll know if that can be used.

https://www.nuget.org/packages/Diplo.AuditLogViewer/10.1.0

fbpenalosa commented 2 months ago

@DanDiplo Thank you for the update.

I've tested 10.1.0 on my end and the tooltip does display the current time

We'll review this and see if it's beneficial for our product.