From 4191d3bf48cc89bb3b733cb08031005cbb06b8b6 Mon Sep 17 00:00:00 2001
From: kasperk81 <83082615+kasperk81@users.noreply.github.com>
Date: Mon, 27 May 2024 17:01:41 +0300
Subject: [PATCH 1/5] fix formatting for other cultures
---
src/Time.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Time.cs b/src/Time.cs
index 71bee340..ee368731 100644
--- a/src/Time.cs
+++ b/src/Time.cs
@@ -75,7 +75,7 @@ public int Second
/// The string time of day.
public override string ToString()
{
- return this.DateTime.ToString("HH:mm:ss");
+ return this.DateTime.ToString("HH\\:mm\\:ss");
}
}
}
From 2ab931e4df84b5bba4c02d71a54fb4615bc9f35c Mon Sep 17 00:00:00 2001
From: kasperk81 <83082615+kasperk81@users.noreply.github.com>
Date: Tue, 28 May 2024 11:20:28 +0300
Subject: [PATCH 2/5] Update RequestInformationTests.cs
---
.../RequestInformationTests.cs | 35 ++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/Microsoft.Kiota.Abstractions.Tests/RequestInformationTests.cs b/Microsoft.Kiota.Abstractions.Tests/RequestInformationTests.cs
index caaf6110..6ca6e4f2 100644
--- a/Microsoft.Kiota.Abstractions.Tests/RequestInformationTests.cs
+++ b/Microsoft.Kiota.Abstractions.Tests/RequestInformationTests.cs
@@ -1,6 +1,8 @@
-using System;
+using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
+using System.Threading;
using Microsoft.Kiota.Abstractions.Serialization;
using Microsoft.Kiota.Abstractions.Tests.Mocks;
using Moq;
@@ -259,6 +261,37 @@ public void SetsPathParametersOfTimeType()
Assert.Contains($"%24time=06%3A00%3A00", requestInfo.URI.OriginalString);
}
[Fact]
+ public void CurrentCultureDoesNotAffectTimeSerialization()
+ {
+ // Arrange as the request builders would
+ var requestInfo = new RequestInformation
+ {
+ HttpMethod = Method.GET,
+ UrlTemplate = "http://localhost/users{?%24time}"
+ };
+
+ var currentCulture = CultureInfo.CurrentCulture;
+ var currentUICulture = CultureInfo.CurrentUICulture;
+
+ // Act
+ Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("da-DK");
+ Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("da-DK");
+ var time = new Time(6, 0, 0);
+ var pathParameters = new Dictionary
+ {
+ { "%24time", time }
+ };
+
+ requestInfo.PathParameters = pathParameters;
+
+ // Assert
+ Assert.Contains($"%24time=06%3A00%3A00", requestInfo.URI.OriginalString);
+
+ // Cleanup
+ Thread.CurrentThread.CurrentCulture = currentCulture;
+ Thread.CurrentThread.CurrentUICulture = currentUICulture;
+ }
+ [Fact]
public void ThrowsInvalidOperationExceptionWhenBaseUrlNotSet()
{
// Arrange as the request builders would
From 68ec5a3233c876a94ce16cd7be79b750d45af970 Mon Sep 17 00:00:00 2001
From: kasperk81 <83082615+kasperk81@users.noreply.github.com>
Date: Tue, 28 May 2024 11:20:57 +0300
Subject: [PATCH 3/5] Update Microsoft.Kiota.Abstractions.csproj
---
src/Microsoft.Kiota.Abstractions.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Microsoft.Kiota.Abstractions.csproj b/src/Microsoft.Kiota.Abstractions.csproj
index e28748c7..d4365c58 100644
--- a/src/Microsoft.Kiota.Abstractions.csproj
+++ b/src/Microsoft.Kiota.Abstractions.csproj
@@ -15,7 +15,7 @@
https://aka.ms/kiota/docs
true
true
- 1.9.2
+ 1.9.3
true
false
From b54c3c686cdf2054d4517ec469ff2f5bf8c5a7ef Mon Sep 17 00:00:00 2001
From: kasperk81 <83082615+kasperk81@users.noreply.github.com>
Date: Tue, 28 May 2024 11:22:47 +0300
Subject: [PATCH 4/5] Update CHANGELOG.md
---
CHANGELOG.md | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8daab57f..09e76078 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
-## [1.9.1] - 2024-05-24
+## [1.9.3] - 2024-05-28
+
+### Changed
+
+- Fix time formatting for other cultures.
+
+## [1.9.2] - 2024-05-24
### Changed
From 4cd74fd4a0a52ab8049b535982038ac78bfb5ec4 Mon Sep 17 00:00:00 2001
From: kasperk81 <83082615+kasperk81@users.noreply.github.com>
Date: Tue, 28 May 2024 11:23:23 +0300
Subject: [PATCH 5/5] simplify
---
Microsoft.Kiota.Abstractions.Tests/RequestInformationTests.cs | 3 ---
1 file changed, 3 deletions(-)
diff --git a/Microsoft.Kiota.Abstractions.Tests/RequestInformationTests.cs b/Microsoft.Kiota.Abstractions.Tests/RequestInformationTests.cs
index 6ca6e4f2..df3e4812 100644
--- a/Microsoft.Kiota.Abstractions.Tests/RequestInformationTests.cs
+++ b/Microsoft.Kiota.Abstractions.Tests/RequestInformationTests.cs
@@ -271,11 +271,9 @@ public void CurrentCultureDoesNotAffectTimeSerialization()
};
var currentCulture = CultureInfo.CurrentCulture;
- var currentUICulture = CultureInfo.CurrentUICulture;
// Act
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("da-DK");
- Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("da-DK");
var time = new Time(6, 0, 0);
var pathParameters = new Dictionary
{
@@ -289,7 +287,6 @@ public void CurrentCultureDoesNotAffectTimeSerialization()
// Cleanup
Thread.CurrentThread.CurrentCulture = currentCulture;
- Thread.CurrentThread.CurrentUICulture = currentUICulture;
}
[Fact]
public void ThrowsInvalidOperationExceptionWhenBaseUrlNotSet()