From 68b4620042af7c7dfa2ee36e9ba80ad669616332 Mon Sep 17 00:00:00 2001 From: RXG <912310479@qq.com> Date: Wed, 31 Jul 2024 23:54:32 +0800 Subject: [PATCH] Fix the detection of BIOS date format: "yyyy-mm-dd" (#1248) * Update SMBios.cs Fix detect format "yyyy-mm-dd" again * Update SMBios.cs --------- Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com> --- LibreHardwareMonitorLib/Hardware/SMBios.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/LibreHardwareMonitorLib/Hardware/SMBios.cs b/LibreHardwareMonitorLib/Hardware/SMBios.cs index 0fe5d64..e47aa52 100644 --- a/LibreHardwareMonitorLib/Hardware/SMBios.cs +++ b/LibreHardwareMonitorLib/Hardware/SMBios.cs @@ -648,15 +648,9 @@ public class BiosInformation : InformationBase int.TryParse(parts[1], out int day) && int.TryParse(parts[2], out int year)) { - if (day > 31) - { - (year, day) = (day, year); - } - - if (month > 12) - { - (month, day) = (day, month); - } + // Check if the SMBIOS specification is followed. + if (month > 12 || day > 31) + return null; return new DateTime(year < 100 ? 1900 + year : year, month, day); }