From 149f480addb34588490e3109d5423a9c15d5af82 Mon Sep 17 00:00:00 2001 From: Laura Gomez Date: Tue, 30 Jul 2019 12:16:29 -0400 Subject: [PATCH] fix: Fixing JSON datetime parsing in 2017 --- ICD.Common.Utils/Extensions/JsonReaderExtensions.cs | 4 ++++ ICD.Common.Utils/Json/JsonUtils.cs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ICD.Common.Utils/Extensions/JsonReaderExtensions.cs b/ICD.Common.Utils/Extensions/JsonReaderExtensions.cs index 1a5f128..808b25c 100644 --- a/ICD.Common.Utils/Extensions/JsonReaderExtensions.cs +++ b/ICD.Common.Utils/Extensions/JsonReaderExtensions.cs @@ -213,8 +213,12 @@ namespace ICD.Common.Utils.Extensions if (extends == null) throw new ArgumentNullException("extends"); +#if SIMPLSHARP string stringValue = extends.GetValueAsString(); return JsonUtils.ParseDateTime(stringValue); +#else + return (DateTime)extends.Value; +#endif } } } diff --git a/ICD.Common.Utils/Json/JsonUtils.cs b/ICD.Common.Utils/Json/JsonUtils.cs index 105b9c4..73e7140 100644 --- a/ICD.Common.Utils/Json/JsonUtils.cs +++ b/ICD.Common.Utils/Json/JsonUtils.cs @@ -39,7 +39,11 @@ namespace ICD.Common.Utils.Json if (token == null) throw new ArgumentNullException("token"); +#if SIMPLSHARP return ParseDateTime((string)token); +#else + return (DateTime)token; +#endif } ///