Skip to content

Commit

Permalink
Invoked DateTime.ToString() with CultureInvariant
Browse files Browse the repository at this point in the history
  • Loading branch information
Henning Normann committed Oct 1, 2024
1 parent 6bfba52 commit c5858a0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Storage/Controllers/MessageboxInstancesController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
Expand Down Expand Up @@ -409,35 +410,35 @@ private static InstanceQueryParameters GetQueryParams(MessageBoxQueryModel query

if (queryModel.FromLastChanged != null)
{
queryParams.LastChanged = $"gte:{queryModel.FromLastChanged?.ToString(dateTimeFormat)}";
queryParams.LastChanged = $"gte:{queryModel.FromLastChanged?.ToString(dateTimeFormat, CultureInfo.InvariantCulture)}";
}

if (queryModel.ToLastChanged != null)
{
if (string.IsNullOrEmpty(queryParams.LastChanged))
{
queryParams.LastChanged = $"lte:{queryModel.ToLastChanged?.ToString(dateTimeFormat)}";
queryParams.LastChanged = $"lte:{queryModel.ToLastChanged?.ToString(dateTimeFormat, CultureInfo.InvariantCulture)}";
}
else
{
queryParams.LastChanged = string.Concat(queryParams.LastChanged, $"lte:{queryModel.ToLastChanged?.ToString(dateTimeFormat)}");
queryParams.LastChanged = string.Concat(queryParams.LastChanged, $"lte:{queryModel.ToLastChanged?.ToString(dateTimeFormat, CultureInfo.InvariantCulture)}");
}
}

if (queryModel.FromCreated != null)
{
queryParams.MsgBoxInterval = [$"gte:{queryModel.FromCreated?.ToString(dateTimeFormat)}"];
queryParams.MsgBoxInterval = [$"gte:{queryModel.FromCreated?.ToString(dateTimeFormat, CultureInfo.InvariantCulture)}"];
}

if (queryModel.ToCreated != null)
{
if (queryParams.MsgBoxInterval == null || queryParams.MsgBoxInterval.Length == 0)
{
queryParams.MsgBoxInterval = [$"lte:{queryModel.ToCreated?.ToString(dateTimeFormat)}"];
queryParams.MsgBoxInterval = [$"lte:{queryModel.ToCreated?.ToString(dateTimeFormat, CultureInfo.InvariantCulture)}"];
}
else
{
queryParams.MsgBoxInterval = queryParams.MsgBoxInterval.Concat([$"lte:{queryModel.ToCreated?.ToString(dateTimeFormat)}"]).ToArray();
queryParams.MsgBoxInterval = queryParams.MsgBoxInterval.Concat([$"lte:{queryModel.ToCreated?.ToString(dateTimeFormat, CultureInfo.InvariantCulture)}"]).ToArray();
}
}

Expand Down

0 comments on commit c5858a0

Please sign in to comment.