mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 18:57:39 -07:00
fixed some issues here and there.
This commit is contained in:
parent
4deecde092
commit
85cd877b0c
12 changed files with 66 additions and 20 deletions
40
NzbDrone.Core/Datastore/Converters/UtcDateTimeConverter.cs
Normal file
40
NzbDrone.Core/Datastore/Converters/UtcDateTimeConverter.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
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)
|
||||
{
|
||||
return ((DateTime)clrValue).ToUniversalTime();
|
||||
}
|
||||
|
||||
return DBNull.Value;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue