From 5e0ab46e578aab13b238aee92787d57bc45bc6a2 Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Mon, 11 Sep 2023 15:21:36 +0500 Subject: [PATCH] Fix TelemetryDataBaseService.GetAsync Db dateTime timezone TimestampBehavior --- .../Services/SAUB/TelemetryDataBaseService.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs index cdb0daf7..bfb173da 100644 --- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs +++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs @@ -166,10 +166,16 @@ namespace AsbCloudInfrastructure.Services.SAUB .AsNoTracking(); if (request.GeDate.HasValue) - query = query.Where(d => d.DateTime >= request.GeDate); + { + var geDate = request.GeDate.Value.UtcDateTime; + query = query.Where(d => d.DateTime >= geDate); + } if (request.LeDate.HasValue) - query = query.Where(d => d.DateTime >= request.LeDate); + { + var leDate = request.LeDate.Value.UtcDateTime; + query = query.Where(d => d.DateTime <= leDate); + } if (request.Divider > 1) query = query.Where((d) => (((d.DateTime.DayOfYear * 24 + d.DateTime.Hour) * 60 + d.DateTime.Minute) * 60 + d.DateTime.Second) % request.Divider == 0);