From da95bd6127474cfe03692d09c22b34b1e0263b49 Mon Sep 17 00:00:00 2001 From: Alex Gidge Date: Sun, 7 Mar 2021 22:51:50 +0000 Subject: [PATCH 1/3] #1725 - Added start date & changed display timezone --- BTCPayServer/Controllers/PullPaymentController.cs | 3 ++- BTCPayServer/Models/ViewPullPaymentModel.cs | 3 ++- BTCPayServer/Views/PullPayment/ViewPullPayment.cshtml | 9 +++++++-- BTCPayServer/Views/Server/Files.cshtml | 2 +- BTCPayServer/Views/ViewsRazor.cs | 11 ++++++----- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/BTCPayServer/Controllers/PullPaymentController.cs b/BTCPayServer/Controllers/PullPaymentController.cs index ca24e3fe9..c2d1c7c8c 100644 --- a/BTCPayServer/Controllers/PullPaymentController.cs +++ b/BTCPayServer/Controllers/PullPaymentController.cs @@ -70,7 +70,8 @@ namespace BTCPayServer.Controllers ClaimedAmount = amountDue, AmountDueFormatted = _currencyNameTable.FormatCurrency(amountDue, blob.Currency), CurrencyData = cd, - LastUpdated = DateTime.Now, + StartDate = pp.StartDate, + LastRefreshed = DateTime.Now, Payouts = payouts .Select(entity => new ViewPullPaymentModel.PayoutLine { diff --git a/BTCPayServer/Models/ViewPullPaymentModel.cs b/BTCPayServer/Models/ViewPullPaymentModel.cs index 603d8517a..05071240d 100644 --- a/BTCPayServer/Models/ViewPullPaymentModel.cs +++ b/BTCPayServer/Models/ViewPullPaymentModel.cs @@ -76,7 +76,8 @@ namespace BTCPayServer.Models public string EmbeddedCSS { get; set; } public string CustomCSSLink { get; set; } public List Payouts { get; set; } = new List(); - public DateTime LastUpdated { get; set; } + public DateTimeOffset StartDate { get; set; } + public DateTime LastRefreshed { get; set; } public CurrencyData CurrencyData { get; set; } public string AmountCollectedFormatted { get; set; } public string AmountFormatted { get; set; } diff --git a/BTCPayServer/Views/PullPayment/ViewPullPayment.cshtml b/BTCPayServer/Views/PullPayment/ViewPullPayment.cshtml index ef722b819..19b65ed5c 100644 --- a/BTCPayServer/Views/PullPayment/ViewPullPayment.cshtml +++ b/BTCPayServer/Views/PullPayment/ViewPullPayment.cshtml @@ -89,9 +89,14 @@

@Model.Title

}
- Last Updated + Start Date   - @Model.LastUpdated.ToString("g") + @Model.StartDate.ToBrowserDate() +
+
+ Last Refreshed +   + @Model.LastRefreshed.ToBrowserDate() diff --git a/BTCPayServer/Views/Server/Files.cshtml b/BTCPayServer/Views/Server/Files.cshtml index 71f6fac30..10962ed70 100644 --- a/BTCPayServer/Views/Server/Files.cshtml +++ b/BTCPayServer/Views/Server/Files.cshtml @@ -28,7 +28,7 @@ { @file.FileName - @file.Timestamp.ToBrowserDate2() + @file.Timestamp.ToBrowserDate() @file.ApplicationUser.UserName Get Link diff --git a/BTCPayServer/Views/ViewsRazor.cs b/BTCPayServer/Views/ViewsRazor.cs index ef41d0c67..36c1ebfb1 100644 --- a/BTCPayServer/Views/ViewsRazor.cs +++ b/BTCPayServer/Views/ViewsRazor.cs @@ -28,15 +28,16 @@ namespace BTCPayServer.Views public static HtmlString ToBrowserDate(this DateTimeOffset date) { - var hello = date.ToString("o", CultureInfo.InvariantCulture); - return new HtmlString($"{hello}"); + var displayDate = date.ToString("g", CultureInfo.InvariantCulture); + return new HtmlString($"{displayDate}"); } - public static HtmlString ToBrowserDate2(this DateTime date) + public static HtmlString ToBrowserDate(this DateTime date) { - var hello = date.ToString("o", CultureInfo.InvariantCulture); - return new HtmlString($"{hello}"); + var displayDate = date.ToString("g", CultureInfo.InvariantCulture); + return new HtmlString($"{displayDate}"); } + public static string ToTimeAgo(this DateTimeOffset date) { var formatted = (DateTimeOffset.UtcNow - date).TimeString() + " ago"; From 0d2de4c42154d395e26f5fe745aa5450efe40387 Mon Sep 17 00:00:00 2001 From: Alex Gidge Date: Sun, 7 Mar 2021 23:19:39 +0000 Subject: [PATCH 2/3] #1725 - Changed to display in user's local date time format --- BTCPayServer/Views/ViewsRazor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BTCPayServer/Views/ViewsRazor.cs b/BTCPayServer/Views/ViewsRazor.cs index 36c1ebfb1..0ba2ec818 100644 --- a/BTCPayServer/Views/ViewsRazor.cs +++ b/BTCPayServer/Views/ViewsRazor.cs @@ -28,13 +28,13 @@ namespace BTCPayServer.Views public static HtmlString ToBrowserDate(this DateTimeOffset date) { - var displayDate = date.ToString("g", CultureInfo.InvariantCulture); + var displayDate = date.ToString("g"); return new HtmlString($"{displayDate}"); } public static HtmlString ToBrowserDate(this DateTime date) { - var displayDate = date.ToString("g", CultureInfo.InvariantCulture); + var displayDate = date.ToString("g"); return new HtmlString($"{displayDate}"); } From a7d324901d52aea628310b4c4af741a9bf336cd7 Mon Sep 17 00:00:00 2001 From: Alex Gidge Date: Mon, 8 Mar 2021 08:45:16 +0000 Subject: [PATCH 3/3] Reverted "Last Refreshed" back to "Last Updated" Co-authored-by: Zaxounette <51208677+Zaxounette@users.noreply.github.com> --- BTCPayServer/Views/PullPayment/ViewPullPayment.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BTCPayServer/Views/PullPayment/ViewPullPayment.cshtml b/BTCPayServer/Views/PullPayment/ViewPullPayment.cshtml index 19b65ed5c..7a1c1a199 100644 --- a/BTCPayServer/Views/PullPayment/ViewPullPayment.cshtml +++ b/BTCPayServer/Views/PullPayment/ViewPullPayment.cshtml @@ -94,7 +94,7 @@ @Model.StartDate.ToBrowserDate()
- Last Refreshed + Last Updated   @Model.LastRefreshed.ToBrowserDate()