diff --git a/src/Snap.Hutao/Snap.Hutao/Core/Json/Converter/DateTimeOffsetConverter.cs b/src/Snap.Hutao/Snap.Hutao/Core/Json/Converter/DateTimeOffsetConverter.cs index be8eaef3..d9585277 100644 --- a/src/Snap.Hutao/Snap.Hutao/Core/Json/Converter/DateTimeOffsetConverter.cs +++ b/src/Snap.Hutao/Snap.Hutao/Core/Json/Converter/DateTimeOffsetConverter.cs @@ -27,6 +27,6 @@ internal class DateTimeOffsetConverter : JsonConverter /// public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) { - writer.WriteStringValue(value.ToString(Format, CultureInfo.CurrentCulture)); + writer.WriteStringValue(value.ToLocalTime().ToString(Format, CultureInfo.CurrentCulture)); } } \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/SettingPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/SettingPage.xaml index f7098c72..04ad3645 100644 --- a/src/Snap.Hutao/Snap.Hutao/View/Page/SettingPage.xaml +++ b/src/Snap.Hutao/Snap.Hutao/View/Page/SettingPage.xaml @@ -225,7 +225,8 @@ VerticalAlignment="Center" DisplayMemberPath="Name" ItemsSource="{Binding HotKeyOptions.VirtualKeys}" - SelectedItem="{Binding HotKeyOptions.MouseClickRepeatForeverKeyCombination.KeyNameValue, Mode=TwoWay}"/> + SelectedItem="{Binding HotKeyOptions.MouseClickRepeatForeverKeyCombination.KeyNameValue, Mode=TwoWay}" + Style="{StaticResource DefaultComboBoxStyle}"/> ServerTimeZoneInfo.UsaTimeZone, + "os_euro" => ServerTimeZoneInfo.EuroTimeZone, + _ => ServerTimeZoneInfo.CommonTimeZone, + }; + } + /// public override string ToString() { diff --git a/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/ServerTimeZoneInfo.cs b/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/ServerTimeZoneInfo.cs new file mode 100644 index 00000000..03d07838 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/ServerTimeZoneInfo.cs @@ -0,0 +1,17 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +namespace Snap.Hutao.Web.Hoyolab; + +internal static class ServerTimeZoneInfo +{ + private static readonly TimeZoneInfo UsaTimeZoneValue = TimeZoneInfo.CreateCustomTimeZone("Server:UTC-05", new TimeSpan(-05, 0, 0), "UTC-05", "UTC-05"); + private static readonly TimeZoneInfo EuroTimeZoneValue = TimeZoneInfo.CreateCustomTimeZone("Server:UTC+02", new TimeSpan(+02, 0, 0), "UTC+02", "UTC+02"); + private static readonly TimeZoneInfo CommonTimeZoneValue = TimeZoneInfo.CreateCustomTimeZone("Server:UTC+08", new TimeSpan(+08, 0, 0), "UTC+08", "UTC+08"); + + public static TimeZoneInfo UsaTimeZone { get => UsaTimeZoneValue; } + + public static TimeZoneInfo EuroTimeZone { get => EuroTimeZoneValue; } + + public static TimeZoneInfo CommonTimeZone { get => CommonTimeZoneValue; } +} \ No newline at end of file