[Awake]Fix crash on negative timezone offsets (#25393)

* [Awake]Fix crash on negative timezone offsets

* fix spellchecker
This commit is contained in:
Jaime Bernardo
2023-04-11 14:26:20 +01:00
committed by GitHub
parent 518f8d6dda
commit 3b5d601295
2 changed files with 4 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
Mode = AwakeMode.PASSIVE; Mode = AwakeMode.PASSIVE;
IntervalHours = 0; IntervalHours = 0;
IntervalMinutes = 0; IntervalMinutes = 0;
ExpirationDateTime = DateTimeOffset.MinValue; ExpirationDateTime = DateTimeOffset.Now;
CustomTrayTimes = new Dictionary<string, int>(); CustomTrayTimes = new Dictionary<string, int>();
} }

View File

@@ -37,7 +37,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
KeepDisplayOn = Properties.KeepDisplayOn, KeepDisplayOn = Properties.KeepDisplayOn,
IntervalMinutes = Properties.IntervalMinutes, IntervalMinutes = Properties.IntervalMinutes,
IntervalHours = Properties.IntervalHours, IntervalHours = Properties.IntervalHours,
ExpirationDateTime = Properties.ExpirationDateTime,
// Fix old buggy default value that might be saved in Settings. Some components don't deal well with negative time zones and minimum time offsets.
ExpirationDateTime = Properties.ExpirationDateTime.Year < 2 ? DateTimeOffset.Now : Properties.ExpirationDateTime,
}, },
}; };
} }