mirror of https://github.com/Sonarr/Sonarr
removed UTC conversion, now being done by DB.
This commit is contained in:
parent
c357d062d3
commit
be81f772df
|
@ -1,40 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Globalization;
|
|
||||||
using Marr.Data.Converters;
|
|
||||||
using Marr.Data.Mapping;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Datastore.Converters
|
|
||||||
{
|
|
||||||
public class UtcDateTimeConverter : IConverter
|
|
||||||
{
|
|
||||||
public Type DbType
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return typeof(DateTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public object FromDB(ColumnMap map, object dbValue)
|
|
||||||
{
|
|
||||||
if (dbValue != null && dbValue != DBNull.Value)
|
|
||||||
{
|
|
||||||
var dateTime = (DateTime)dbValue;
|
|
||||||
dateTime = new DateTime(dateTime.Ticks, DateTimeKind.Local);
|
|
||||||
return dateTime.ToUniversalTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public object ToDB(object clrValue)
|
|
||||||
{
|
|
||||||
if (clrValue != null && clrValue != DBNull.Value)
|
|
||||||
{
|
|
||||||
return ((DateTime)clrValue).ToUniversalTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
return DBNull.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -82,7 +82,6 @@ namespace NzbDrone.Core.Datastore
|
||||||
MapRepository.Instance.RegisterTypeConverter(typeof(Boolean), new BooleanIntConverter());
|
MapRepository.Instance.RegisterTypeConverter(typeof(Boolean), new BooleanIntConverter());
|
||||||
MapRepository.Instance.RegisterTypeConverter(typeof(Enum), new EnumIntConverter());
|
MapRepository.Instance.RegisterTypeConverter(typeof(Enum), new EnumIntConverter());
|
||||||
MapRepository.Instance.RegisterTypeConverter(typeof(Quality), new QualityIntConverter());
|
MapRepository.Instance.RegisterTypeConverter(typeof(Quality), new QualityIntConverter());
|
||||||
MapRepository.Instance.RegisterTypeConverter(typeof(DateTime), new UtcDateTimeConverter());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RegisterEmbeddedConverter()
|
private static void RegisterEmbeddedConverter()
|
||||||
|
|
|
@ -193,7 +193,6 @@
|
||||||
<Compile Include="Datastore\Converters\QualityIntConverter.cs" />
|
<Compile Include="Datastore\Converters\QualityIntConverter.cs" />
|
||||||
<Compile Include="Datastore\Converters\Int32Converter.cs" />
|
<Compile Include="Datastore\Converters\Int32Converter.cs" />
|
||||||
<Compile Include="Datastore\Converters\EmbeddedDocumentConverter.cs" />
|
<Compile Include="Datastore\Converters\EmbeddedDocumentConverter.cs" />
|
||||||
<Compile Include="Datastore\Converters\UtcDateTimeConverter.cs" />
|
|
||||||
<Compile Include="Datastore\Database.cs" />
|
<Compile Include="Datastore\Database.cs" />
|
||||||
<Compile Include="Datastore\DbFactory.cs" />
|
<Compile Include="Datastore\DbFactory.cs" />
|
||||||
<Compile Include="Datastore\Converters\EnumIntConverter.cs" />
|
<Compile Include="Datastore\Converters\EnumIntConverter.cs" />
|
||||||
|
|
Loading…
Reference in New Issue