Add DateTime Nullale support

Update TypeHelper.cs

Signed-off-by: Gary Jia <35099424+jiaguangli@users.noreply.github.com>
This commit is contained in:
Gary Jia 2024-07-08 09:29:20 +08:00 committed by GitHub
parent a51bfbe7c7
commit 5230c8d273
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -122,6 +122,8 @@
newValue = _v2;
else if (double.TryParse(vs, NumberStyles.None, CultureInfo.InvariantCulture, out var _d))
newValue = DateTimeHelper.FromOADate(_d);
else if (pInfo.Nullable && string.IsNullOrWhiteSpace(vs))
newValue = null;
else
throw new InvalidCastException($"{vs} can't cast to datetime");
}