Skip to content

Commit 0ee53de

Browse files
committed
v5.3.0: Change SchemaDateRange.Start/End from string to DateTimeOffset (Issue #21)
BREAKING: SchemaDateRange.Start and .End are now DateTimeOffset instead of string, matching DatasetRange for type consistency. Code that assigned these to string variables will need `.ToString("o")` for ISO 8601 output. Also adds Duration computed property and [JsonIgnore] on both DatasetRange and SchemaDateRange Duration properties to prevent serialization leakage.
1 parent 0d85128 commit 0ee53de

4 files changed

Lines changed: 20 additions & 9 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# databento-dotnet
22

3-
[![NuGet](https://img.shields.io/badge/NuGet-v5.2.3-blue)](https://www.nuget.org/packages/Databento.Client)
4-
[![Downloads](https://img.shields.io/badge/Downloads-15.4K-blue)](https://www.nuget.org/packages/Databento.Client)
3+
[![NuGet](https://img.shields.io/badge/NuGet-v5.3.0-blue)](https://www.nuget.org/packages/Databento.Client)
4+
[![Downloads](https://img.shields.io/badge/Downloads-16.6K-blue)](https://www.nuget.org/packages/Databento.Client)
55
[![.NET](https://img.shields.io/badge/.NET-8.0%20%7C%209.0-purple)](https://dotnet.microsoft.com/)
66
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
77

src/Databento.Client/Databento.Client.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<!-- Package Information -->
1111
<PackageId>Databento.Client</PackageId>
12-
<Version>5.2.3</Version>
12+
<Version>5.3.0</Version>
1313
<Authors>Alparse</Authors>
1414
<Company>Databento</Company>
1515
<Product>databento-dotnet</Product>
@@ -20,7 +20,7 @@
2020
<RepositoryType>git</RepositoryType>
2121
<PackageProjectUrl>https://github.com/Alparse/databento-dotnet</PackageProjectUrl>
2222
<PackageReadmeFile>README.md</PackageReadmeFile>
23-
<PackageReleaseNotes>v5.2.3: Fix native DLLs built with debug configuration that required VCRUNTIME140D.dll/ucrtbased.dll (Issue #18)</PackageReleaseNotes>
23+
<PackageReleaseNotes>v5.3.0: BREAKING — SchemaDateRange.Start and .End changed from string to DateTimeOffset for type consistency with DatasetRange (Issue #21). If you accessed these as strings, use .ToString("o") for equivalent output.</PackageReleaseNotes>
2424
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
2525

2626
<!-- XML Documentation -->

src/Databento.Client/Models/Metadata/DatasetRange.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System.Text.Json.Serialization;
2+
13
namespace Databento.Client.Models.Metadata;
24

35
/// <summary>
@@ -24,6 +26,7 @@ public class DatasetRange
2426
/// <summary>
2527
/// Duration of available data
2628
/// </summary>
29+
[JsonIgnore]
2730
public TimeSpan Duration => End - Start;
2831

2932
public override string ToString()
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System.Text.Json.Serialization;
2+
13
namespace Databento.Client.Models.Metadata;
24

35
/// <summary>
@@ -6,17 +8,23 @@ namespace Databento.Client.Models.Metadata;
68
public class SchemaDateRange
79
{
810
/// <summary>
9-
/// Start timestamp (ISO 8601)
11+
/// Start timestamp
12+
/// </summary>
13+
public DateTimeOffset Start { get; set; }
14+
15+
/// <summary>
16+
/// End timestamp (exclusive)
1017
/// </summary>
11-
public string Start { get; set; } = string.Empty;
18+
public DateTimeOffset End { get; set; }
1219

1320
/// <summary>
14-
/// End timestamp (ISO 8601, exclusive)
21+
/// Duration of available data for this schema
1522
/// </summary>
16-
public string End { get; set; } = string.Empty;
23+
[JsonIgnore]
24+
public TimeSpan Duration => End - Start;
1725

1826
public override string ToString()
1927
{
20-
return $"{Start} to {End}";
28+
return $"{Start:yyyy-MM-dd HH:mm:ss} to {End:yyyy-MM-dd HH:mm:ss}";
2129
}
2230
}

0 commit comments

Comments
 (0)