UI: Fix missing timezone in browser dates (#4210)

Fix for an issue brought up by @petzsch in todays dev meeting.
This commit is contained in:
d11n 2022-10-13 09:29:30 +02:00 committed by GitHub
parent 434298cba6
commit 4ae2ea32e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,7 +96,7 @@ namespace BTCPayServer.Abstractions.Extensions
{
var relative = date.ToTimeAgo();
var initial = format.ToString().ToLower();
var dateTime = date.ToString("s", CultureInfo.InvariantCulture);
var dateTime = date.ToString("o", CultureInfo.InvariantCulture);
var displayDate = format == DateDisplayFormat.Relative ? relative : date.ToString("g", CultureInfo.InvariantCulture);
return new HtmlString($"<time datetime=\"{dateTime}\" data-relative=\"{relative}\" data-initial=\"{initial}\">{displayDate}</time>");
}
@ -105,7 +105,7 @@ namespace BTCPayServer.Abstractions.Extensions
{
var relative = date.ToTimeAgo();
var initial = format.ToString().ToLower();
var dateTime = date.ToString("s", CultureInfo.InvariantCulture);
var dateTime = date.ToString("o", CultureInfo.InvariantCulture);
var displayDate = format == DateDisplayFormat.Relative ? relative : date.ToString("g", CultureInfo.InvariantCulture);
return new HtmlString($"<time datetime=\"{dateTime}\" data-relative=\"{relative}\" data-initial=\"{initial}\">{displayDate}</time>");
}