From b1a4569ebe1e6b04477b08108d7e3bcad706f232 Mon Sep 17 00:00:00 2001 From: HEIGE-PCloud Date: Thu, 3 Feb 2022 09:34:25 +0000 Subject: [PATCH] fix: add InvariantCulture for DateTimeOffset.Parse --- Microsoft.Toolkit.Uwp.SampleApp/Data/DataGridDataSource.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Data/DataGridDataSource.cs b/Microsoft.Toolkit.Uwp.SampleApp/Data/DataGridDataSource.cs index 688b17292..392542171 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Data/DataGridDataSource.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/Data/DataGridDataSource.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Globalization; using System.IO; using System.Linq; using System.Text; @@ -30,6 +31,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.Data StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(uri); IRandomAccessStreamWithContentType randomStream = await file.OpenReadAsync(); _items = new ObservableCollection(); + IFormatProvider provider = CultureInfo.InvariantCulture.DateTimeFormat; using (StreamReader sr = new StreamReader(randomStream.AsStreamForRead())) { @@ -48,7 +50,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.Data Coordinates = values[4], Prominence = uint.Parse(values[5]), Parent_mountain = values[6], - First_ascent = DateTimeOffset.Parse(values[7]), + First_ascent = DateTimeOffset.Parse(values[7], provider), Ascents = values[8], }); }