Update sqlite dateoffset bug

This commit is contained in:
sunkaixuan 2022-09-06 19:43:29 +08:00
parent f12c39259c
commit 104d511d75

View File

@ -60,6 +60,10 @@ namespace SqlSugar
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }
} }
else if (type == UtilConstants.DateTimeOffsetType)
{
return GetDateTimeOffsetString(value);
}
else if (type == UtilConstants.DateType && iswhere) else if (type == UtilConstants.DateType && iswhere)
{ {
var parameterName = this.Builder.SqlParameterKeyWord + name + i; var parameterName = this.Builder.SqlParameterKeyWord + name + i;
@ -97,5 +101,15 @@ namespace SqlSugar
} }
} }
} }
private object GetDateTimeOffsetString(object value)
{
var date = UtilMethods.ConvertFromDateTimeOffset((DateTimeOffset)value);
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
}
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
}
} }
} }