Skip to content

Commit

Permalink
Add support for serializing IEC date
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawid Pągowski committed Aug 22, 2023
1 parent 689e7ff commit e4cc42f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions S7.Net/Protocol/Serialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public static byte[] SerializeDataItem(DataItem dataItem)
_ => Types.String.ToByteArray(s, dataItem.Count)
};

if (dataItem.VarType == VarType.Date)
{
return Date.ToByteArray((System.DateTime)dataItem.Value);
}

return SerializeValue(dataItem.Value);
}

Expand Down

0 comments on commit e4cc42f

Please sign in to comment.