Skip to content

Commit

Permalink
Fix time range calculation for irregular time interval data
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollo3zehn committed Aug 25, 2024
1 parent 8801547 commit cdbdbcd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Nexus.Sources.StructuredFile/StructuredFileDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,14 @@ protected abstract Task<ResourceCatalog> GetCatalogAsync(
.OrderByDescending(current => current.DateTimeOffset.DateTime)
.FirstOrDefault();

var lastDateTimeModified = lastDateTimeOffset.DateTimeOffset.DateTime
.RoundDown(fileSource.FilePeriod)
.Add(fileSource.FilePeriod);
var lastDateTimeModified = fileSource.IrregularTimeInterval

? lastDateTimeOffset.DateTimeOffset.DateTime
.Add(fileSource.FilePeriod)

: lastDateTimeOffset.DateTimeOffset.DateTime
.RoundDown(fileSource.FilePeriod)
.Add(fileSource.FilePeriod);

var lastUtcDateTime = new CustomDateTimeOffset(
lastDateTimeModified,
Expand Down

0 comments on commit cdbdbcd

Please sign in to comment.