Search code examples
datetimeservicestackutc

Why does ServiceStack default Html Snapshot view show the date using DateTime.UtcNow?


When I view my ServiceStack endpoints through a browser, I get the very helpful snapshot of the data in a convenient HTML table. The title looks something like this:

Snapshot of EndPoint generated by ServiceStack on DateTime

The DateTime shown seems to be in UTC format and I'm trying to work out why. In the UK now it is British Summer Time (UTC +1) so ServiceStack always shows the wrong time for this.

The source code is here: https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack/WebHost.Endpoints/Formats/HtmlFormat.cs#L63

My question is:

Is this is a minor bug or is there another reason I am not aware of for displaying the date and time in UTC?


Solution

  • Dates always travel on the wire as UTC, the purpose of ServiceStack's HTML5 Report Format is to display the data from the web service in a human friendly format.