-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from Worth-NL/fix/DecisionScenario_PublishingO…
…bject_WrongJSON Fix/decision scenario publishing object wrong json
- Loading branch information
Showing
41 changed files
with
686 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
EventsHandler/Api/EventsHandler/Extensions/DateTimeExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// © 2024, Worth Systems. | ||
|
||
using System.Globalization; | ||
|
||
namespace EventsHandler.Extensions | ||
{ | ||
/// <summary> | ||
/// Extension methods for <see cref="DateTime"/>s. | ||
/// </summary> | ||
internal static class DateTimeExtensions | ||
{ | ||
private static readonly TimeZoneInfo s_cetTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time"); | ||
private static readonly CultureInfo s_dutchCulture = new("nl-NL"); | ||
|
||
/// <summary> | ||
/// Converts the given <see cref="DateTime"/> into a <see langword="string"/> representation of the local (Dutch) date. | ||
/// </summary> | ||
/// <param name="dateTime">The source date time.</param> | ||
/// <returns> | ||
/// The <see langword="string"/> representation of a date in the following format: | ||
/// <code>2024-09-15</code> | ||
/// </returns> | ||
internal static string ConvertToDutchDateString(this DateTime dateTime) | ||
{ | ||
// Convert time zone from UTC to CET (if necessary) | ||
if (dateTime.Kind == DateTimeKind.Utc) | ||
{ | ||
dateTime = TimeZoneInfo.ConvertTimeFromUtc(dateTime, s_cetTimeZone); | ||
} | ||
|
||
// Formatting the date and time | ||
return dateTime.ToString("yyyy-MM-dd", s_dutchCulture); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 24 additions & 24 deletions
48
EventsHandler/Api/EventsHandler/Properties/Resources.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.