From 612bc2951c60fdc5e63068fbb6b25075e0bcd0ee Mon Sep 17 00:00:00 2001 From: "Dmitrij D. Czarkoff" Date: Sun, 17 Nov 2024 03:40:55 +0100 Subject: [PATCH] fix: use current culture to adjust first days of the week --- src/Models/Statistics.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Models/Statistics.cs b/src/Models/Statistics.cs index b669eb55..6ee29e0c 100644 --- a/src/Models/Statistics.cs +++ b/src/Models/Statistics.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; - +using System.Globalization; using LiveChartsCore; using LiveChartsCore.Defaults; using LiveChartsCore.SkiaSharpView; @@ -138,7 +138,7 @@ namespace SourceGit.Models public Statistics() { _today = DateTime.Now.ToLocalTime().Date; - _thisWeekStart = _today.AddSeconds(-(int)_today.DayOfWeek * 3600 * 24); + _thisWeekStart = _today.AddDays(((int)_today.DayOfWeek + (int)CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek) % 7 - 7); _thisMonthStart = _today.AddDays(1 - _today.Day); All = new StatisticsReport(StaticsticsMode.All, DateTime.MinValue);