Skip to content

Commit 6278de9

Browse files
committed
add datetime format example and removed culture
1 parent 29503e1 commit 6278de9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/web/Client/Extensions/DateTimeExtensions.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
using System.Globalization;
2-
31
namespace Jordnaer.Client.Extensions;
42

53
public static class DateTimeExtensions
64
{
7-
public static string DisplayExactTime(this DateTime date) =>
8-
$"afsendt {date.ToLocalTime().ToString("d/M yyyy kl. HH:mm", new CultureInfo("da-DK"))}";
5+
public static string DisplayExactTime(this DateTime date) =>
6+
// Example of this format: 1/9 2017 kl. 07:45
7+
$"afsendt {date.ToLocalTime():d/M yyyy kl. HH:mm}";
98

109
public static string DisplayTimePassed(this DateTime date)
1110
{
@@ -46,10 +45,14 @@ public static string DisplayTimePassed(this DateTime date)
4645
int weeks = (int)Math.Floor(timeSpan.TotalDays / 7);
4746

4847
if (weeks is 1)
48+
{
4949
return "sendt i sidste uge";
50+
}
5051

5152
if (timeSpan.TotalDays < 365)
53+
{
5254
return $"sendt for {weeks} uger siden";
55+
}
5356

5457
return $"afsendt {date.ToLocalTime():dd/MM/yyyy HH:mm:ss}";
5558
}

0 commit comments

Comments
 (0)