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>
This commit is contained in:
RXG
2024-07-31 17:54:32 +02:00
committed by GitHub
co-authored by PhyxionNL
parent 8ab4def93a
commit 68b4620042
+3 -9
View File
@@ -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);
}