2020-11-25 07:44:11 -07:00
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
|
|
|
|
|
|
namespace Jellyfin.Server.Implementations.ValueConverters
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ValueConverter to specify kind.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class DateTimeKindValueConverter : ValueConverter<DateTime, DateTime>
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="DateTimeKindValueConverter"/> class.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="kind">The kind to specify.</param>
|
|
|
|
|
/// <param name="mappingHints">The mapping hints.</param>
|
2020-12-12 09:20:48 -07:00
|
|
|
|
public DateTimeKindValueConverter(DateTimeKind kind, ConverterMappingHints? mappingHints = null)
|
2020-11-25 07:44:11 -07:00
|
|
|
|
: base(v => v.ToUniversalTime(), v => DateTime.SpecifyKind(v, kind), mappingHints)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-12 09:20:48 -07:00
|
|
|
|
}
|