mirror of
https://github.com/akpaevj/onecmonitor.git
synced 2024-12-14 10:12:52 +02:00
12 lines
438 B
C#
12 lines
438 B
C#
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
namespace OnecMonitor.Server.Converters.Sqlite
|
|
{
|
|
public class DateTimeStringConverter : ValueConverter<DateTime, string>
|
|
{
|
|
public DateTimeStringConverter() : base(
|
|
g => g.Kind == DateTimeKind.Utc ? g.ToString() : g.ToUniversalTime().ToString(),
|
|
s => DateTime.SpecifyKind(DateTime.Parse(s), DateTimeKind.Utc)) { }
|
|
}
|
|
}
|