forked from ddrilling/AsbCloudServer
Fix DateTime minValue exception.
This commit is contained in:
parent
49eaa76bb0
commit
3dc7bc216e
@ -63,6 +63,9 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
public DateTime DateToUtc(DateTime date, double remoteTimezoneOffsetHours)
|
||||
{
|
||||
if (date == default)
|
||||
return new DateTime(0, DateTimeKind.Utc);
|
||||
|
||||
var newDate = date.Kind switch
|
||||
{
|
||||
DateTimeKind.Local => date.ToUniversalTime(),
|
||||
@ -74,6 +77,9 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
public DateTime DateToTimeZone(DateTime date, double remoteTimezoneOffsetHours)
|
||||
{
|
||||
if (date == default)
|
||||
return new DateTime(0, DateTimeKind.Unspecified);
|
||||
|
||||
var newDate = date.Kind switch
|
||||
{
|
||||
DateTimeKind.Local => date.ToUniversalTime().AddHours(remoteTimezoneOffsetHours),
|
||||
|
Loading…
Reference in New Issue
Block a user