diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..af0c6c2
Binary files /dev/null and b/.DS_Store differ
diff --git a/.gitignore b/.gitignore
index dfcfd56..f59de61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -348,3 +348,6 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
+
+# Jetbrains rider idea files
+.idea/
\ No newline at end of file
diff --git a/DSMRParser/DSMRParser.csproj b/DSMRParser/DSMRParser.csproj
index 9c44c30..533ecf3 100644
--- a/DSMRParser/DSMRParser.csproj
+++ b/DSMRParser/DSMRParser.csproj
@@ -44,6 +44,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/DSMRParser/Models/Telegram.cs b/DSMRParser/Models/Telegram.cs
index cfd3aad..29136c6 100644
--- a/DSMRParser/Models/Telegram.cs
+++ b/DSMRParser/Models/Telegram.cs
@@ -6,6 +6,8 @@
using System.Globalization;
using System.Linq;
using System.Text;
+using NodaTime;
+using NodaTime.Text;
namespace DSMRParser.Models;
@@ -26,7 +28,7 @@ public class Telegram(string? identification, IEnumerable<(OBISId obisid, IEnume
{
/// The culture used for parsing values (affecting parsing of values like "1.234,56" vs "1,234.56".
private static readonly CultureInfo _culture = CultureInfo.InvariantCulture;
- private static readonly TimeZoneInfo _dutchtimezone = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time");
+ private static readonly DateTimeZone _dutchtimezone = DateTimeZoneProviders.Tzdb["Europe/Amsterdam"];
/// An empty dictionary of OBIS values.
protected static readonly IReadOnlyDictionary> EMPTY = new ReadOnlyDictionary>(Array.Empty().ToDictionary(i => i.Id, i => Enumerable.Empty()));
@@ -197,9 +199,13 @@ protected static bool TryParseDateTimeOffsetCore(string? value, out DateTimeOffs
{
if (DateTime.TryParseExact(value?.TrimEnd('W', 'S'), "yyMMddHHmmss", _culture, DateTimeStyles.None, out var dt))
{
- result = new DateTimeOffset(dt, _dutchtimezone.GetUtcOffset(dt));
+ var localDt = LocalDateTime.FromDateTime(dt);
+ var zonedDt = localDt.InZoneLeniently(_dutchtimezone);
+ result = zonedDt.ToDateTimeOffset();
+
return true;
}
+
result = default;
return false;
}