fix: use current culture to adjust first days of the week

This commit is contained in:
Dmitrij D. Czarkoff 2024-11-17 03:40:55 +01:00
parent 0fbf53c360
commit 612bc2951c
No known key found for this signature in database

View file

@ -1,6 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using LiveChartsCore; using LiveChartsCore;
using LiveChartsCore.Defaults; using LiveChartsCore.Defaults;
using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView;
@ -138,7 +138,7 @@ namespace SourceGit.Models
public Statistics() public Statistics()
{ {
_today = DateTime.Now.ToLocalTime().Date; _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); _thisMonthStart = _today.AddDays(1 - _today.Day);
All = new StatisticsReport(StaticsticsMode.All, DateTime.MinValue); All = new StatisticsReport(StaticsticsMode.All, DateTime.MinValue);