From 2ef01235079d7229360440b39f1e1d8f2fdd9626 Mon Sep 17 00:00:00 2001 From: Jacopo Cina Date: Thu, 20 Jun 2024 16:06:06 +0200 Subject: [PATCH] fix: default timezone to CET ref: #17577 --- .../Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs | 2 +- Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs | 8 ++++---- Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs | 8 ++++---- Artesian/Artesian.SDK/Factory/BidAsk.cs | 8 ++++---- Artesian/Artesian.SDK/Factory/IMarketData.cs | 9 +++++---- Artesian/Artesian.SDK/Factory/MarketAssessment.cs | 8 ++++---- Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs | 8 ++++---- 7 files changed, 26 insertions(+), 25 deletions(-) diff --git a/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs b/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs index 9151a5e..e0d6be4 100644 --- a/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs +++ b/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs @@ -60,7 +60,7 @@ public DeleteCurveData(MarketDataIdentifier id, LocalDateTime version) /// [Required] [MessagePack.Key(2)] - public string Timezone { get; set; } = "CET"; + public string Timezone { get; set; } /// /// Start date of range to be deleted diff --git a/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs b/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs index ce788b8..d815077 100644 --- a/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs +++ b/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs @@ -150,20 +150,20 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) + /// Timezone of the delete range. Default is CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) + public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) { Ensure.Any.IsNotNull(_entity); - var tz = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone; - var timeZone = DateTimeZoneProviders.Tzdb[tz]; + var timeZone = DateTimeZoneProviders.Tzdb[timezone]; var data = new DeleteCurveData(_identifier) { - Timezone = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone, + Timezone = timezone, // LocalDate.MinIsoValue has year -9998 and yearOfEra 9999. Using it without any string formatting, we got date 01-01-9999. // So we use default(LocalDateTime) 01/01/0001 RangeStart = rangeStart ?? default(LocalDateTime), diff --git a/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs b/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs index cef394c..68dfd6e 100644 --- a/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs +++ b/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs @@ -162,20 +162,20 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) + /// Timezone of the delete range. Default is CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) + public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) { Ensure.Any.IsNotNull(_entity); - var tz = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone; - var timeZone = DateTimeZoneProviders.Tzdb[tz]; + var timeZone = DateTimeZoneProviders.Tzdb[timezone]; var data = new DeleteCurveData(_identifier) { - Timezone = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone, + Timezone = timezone, // LocalDate.MinIsoValue has year -9998 and yearOfEra 9999. Using it without any string formatting, we got date 01-01-9999. // So we use default(LocalDateTime) 01/01/0001 RangeStart = rangeStart ?? default(LocalDateTime), diff --git a/Artesian/Artesian.SDK/Factory/BidAsk.cs b/Artesian/Artesian.SDK/Factory/BidAsk.cs index 03cfd44..a298708 100644 --- a/Artesian/Artesian.SDK/Factory/BidAsk.cs +++ b/Artesian/Artesian.SDK/Factory/BidAsk.cs @@ -153,20 +153,20 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) /// Product of the BidAsk Time Serie + /// Timezone of the delete range. Default is CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - public async Task Delete(LocalDateTime? rangeStart, LocalDateTime? rangeEnd, List product = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) + public async Task Delete(LocalDateTime? rangeStart, LocalDateTime? rangeEnd, List product = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) { Ensure.Any.IsNotNull(_entity); - var tz = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone; - var timeZone = DateTimeZoneProviders.Tzdb[tz]; + var timeZone = DateTimeZoneProviders.Tzdb[timezone]; var data = new DeleteCurveData(_identifier) { - Timezone = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone, + Timezone = timezone, // LocalDate.MinIsoValue has year -9998 and yearOfEra 9999. Using it without any string formatting, we got date 01-01-9999. // So we use default(LocalDateTime) 01/01/0001 RangeStart = rangeStart ?? default(LocalDateTime), diff --git a/Artesian/Artesian.SDK/Factory/IMarketData.cs b/Artesian/Artesian.SDK/Factory/IMarketData.cs index 9524591..9086661 100644 --- a/Artesian/Artesian.SDK/Factory/IMarketData.cs +++ b/Artesian/Artesian.SDK/Factory/IMarketData.cs @@ -169,11 +169,12 @@ public interface IMarketAssessmentWritable /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) /// Product of the MarketAssessment Time Serie + /// Timezone of the delete range. Default is CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); + Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); } /// @@ -237,7 +238,7 @@ public interface IBidAskWritable /// DeferDataGeneration /// The Cancellation Token /// - Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); + Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); } /// /// Interface for Auction Bid Write @@ -299,7 +300,7 @@ public interface IAuctionMarketDataWritable /// DeferDataGeneration /// The Cancellation Token /// - Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); } + Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); } /// /// Interface for timeserie write @@ -367,6 +368,6 @@ public interface ITimeserieWritable /// DeferDataGeneration /// The Cancellation Token /// - Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); + Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); } } \ No newline at end of file diff --git a/Artesian/Artesian.SDK/Factory/MarketAssessment.cs b/Artesian/Artesian.SDK/Factory/MarketAssessment.cs index f527724..6270234 100644 --- a/Artesian/Artesian.SDK/Factory/MarketAssessment.cs +++ b/Artesian/Artesian.SDK/Factory/MarketAssessment.cs @@ -154,20 +154,20 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) /// Product of the MarketAssessment Time Serie + /// Timezone of the delete range. Default is CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) + public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) { Ensure.Any.IsNotNull(_entity); - var tz = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone; - var timeZone = DateTimeZoneProviders.Tzdb[tz]; + var timeZone = DateTimeZoneProviders.Tzdb[timezone]; var data = new DeleteCurveData(_identifier) { - Timezone = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone, + Timezone = timezone, // LocalDate.MinIsoValue has year -9998 and yearOfEra 9999. Using it without any string formatting, we got date 01-01-9999. // So we use default(LocalDateTime) 01/01/0001 RangeStart = rangeStart ?? default(LocalDateTime), diff --git a/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs b/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs index bffa75f..5191cf6 100644 --- a/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs +++ b/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs @@ -175,20 +175,20 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) + /// Timezone of the delete range. Default is CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) + public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) { Ensure.Any.IsNotNull(_entity); - var tz = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone; - var timeZone = DateTimeZoneProviders.Tzdb[tz]; + var timeZone = DateTimeZoneProviders.Tzdb[timezone]; var data = new DeleteCurveData(_identifier) { - Timezone = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone, + Timezone = timezone, // LocalDate.MinIsoValue has year -9998 and yearOfEra 9999. Using it without any string formatting, we got date 01-01-9999. // So we use default(LocalDateTime) 01/01/0001 RangeStart = rangeStart ?? default(LocalDateTime),