Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

simplified DateType conversions, because DateTimeOffset does abide by…

… day light savings contrary to what I thought in the previous commit d1f8bb5
  • Loading branch information...
commit 1cb043b69b65b694d8250cadf3bed3c9983e0683 1 parent 234fc21
@nberardi nberardi authored
Showing with 2 additions and 11 deletions.
  1. +2 −11 src/Types/DateTypeConverter.cs
View
13 src/Types/DateTypeConverter.cs
@@ -74,12 +74,7 @@ public override DateTimeOffset ConvertFromInternal(object value)
return FromUnixTime(Convert.ToInt64((ulong)value));
if (value is DateTime)
- {
- var dt = (DateTime)value;
- var utc = dt.Kind == DateTimeKind.Utc;
-
- return new DateTimeOffset(dt.Ticks, utc ? TimeSpan.Zero : (DateTimeOffset.Now.Offset));
- }
+ return new DateTimeOffset((DateTime)value);
return default(DateTimeOffset);
}
@@ -99,11 +94,7 @@ public override object ConvertToInternal(DateTimeOffset value, Type destinationT
return (ulong)ToUnixTime(value);
if (destinationType == typeof(DateTime))
- {
- var offset = DateTimeOffset.Now.Offset;
- var localDateTime = new DateTime((value.UtcDateTime + offset).Ticks, DateTimeKind.Local);
- return localDateTime;
- }
+ return value.LocalDateTime;
if (destinationType == typeof(string))
return value.ToString("u");
Please sign in to comment.
Something went wrong with that request. Please try again.