From e4cc42fa51d15b68f3593bab29a17219bda3bdac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20P=C4=85gowski?= Date: Wed, 23 Aug 2023 01:04:23 +0200 Subject: [PATCH] Add support for serializing IEC date --- S7.Net/Protocol/Serialization.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/S7.Net/Protocol/Serialization.cs b/S7.Net/Protocol/Serialization.cs index 3d114b6..fce3bef 100644 --- a/S7.Net/Protocol/Serialization.cs +++ b/S7.Net/Protocol/Serialization.cs @@ -26,6 +26,11 @@ namespace S7.Net.Protocol _ => Types.String.ToByteArray(s, dataItem.Count) }; + if (dataItem.VarType == VarType.Date) + { + return Date.ToByteArray((System.DateTime)dataItem.Value); + } + return SerializeValue(dataItem.Value); }