Skip to content

Commit 7ddf754

Browse files
committed
InvariantCulture on rangequery
1 parent 2d75323 commit 7ddf754

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Nest/DSL/Query/RangeQueryDescriptor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,25 +188,25 @@ public RangeQueryDescriptor<T> LowerOrEquals(string to)
188188

189189
public RangeQueryDescriptor<T> Greater(DateTime? from, string format = "yyyy-MM-dd'T'HH:mm:ss.fff")
190190
{
191-
this.Self.GreaterThan = from.HasValue ? from.Value.ToString(format) : null;
191+
this.Self.GreaterThan = from.HasValue ? from.Value.ToString(format, CultureInfo.InvariantCulture) : null;
192192
return this;
193193
}
194194

195195
public RangeQueryDescriptor<T> GreaterOrEquals(DateTime? from, string format = "yyyy-MM-dd'T'HH:mm:ss.fff")
196196
{
197-
this.Self.GreaterThanOrEqualTo = from.HasValue ? from.Value.ToString(format) : null;
197+
this.Self.GreaterThanOrEqualTo = from.HasValue ? from.Value.ToString(format, CultureInfo.InvariantCulture) : null;
198198
return this;
199199
}
200200

201201
public RangeQueryDescriptor<T> Lower(DateTime? to, string format = "yyyy-MM-dd'T'HH:mm:ss.fff")
202202
{
203-
this.Self.LowerThan = to.HasValue ? to.Value.ToString(format) : null;
203+
this.Self.LowerThan = to.HasValue ? to.Value.ToString(format, CultureInfo.InvariantCulture) : null;
204204
return this;
205205
}
206206

207207
public RangeQueryDescriptor<T> LowerOrEquals(DateTime? to, string format = "yyyy-MM-dd'T'HH:mm:ss.fff")
208208
{
209-
this.Self.LowerThanOrEqualTo = to.HasValue ? to.Value.ToString(format) : null;
209+
this.Self.LowerThanOrEqualTo = to.HasValue ? to.Value.ToString(format, CultureInfo.InvariantCulture) : null;
210210
return this;
211211
}
212212

src/Tests/Nest.Tests.Unit/Nest.Tests.Unit.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@
416416
<Compile Include="Reproduce\Reproduce1396Tests.cs" />
417417
<Compile Include="Reproduce\Reproduce1199Tests.cs" />
418418
<Compile Include="Reproduce\Reproduce1146Tests.cs" />
419+
<Compile Include="Reproduce\Reproduce1440Tests.cs" />
419420
<Compile Include="Reproduce\Reproduce1464Tests.cs" />
420421
<Compile Include="Reproduce\Reproduce629Tests.cs" />
421422
<Compile Include="Reproduce\Reproduce1187Tests.cs" />

0 commit comments

Comments
 (0)