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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user