Skip to content

Commit f2fe2e6

Browse files
[Windows]Fix Dot based Date Format property in DatePicker not working on Windows (#29058)
* fix added * Test added * namespace changes added * modified the test * Windows and iOS snap added * Android snap added
1 parent 42aa3d2 commit f2fe2e6

File tree

6 files changed

+54
-0
lines changed

6 files changed

+54
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace Maui.Controls.Sample.Issues;
2+
3+
[Issue(IssueTracker.Github, 10805, "Date Format property in DatePicker not working on Windows with date Format", PlatformAffected.UWP)]
4+
public class Issue10805 : ContentPage
5+
{
6+
public Issue10805()
7+
{
8+
var label = new Label
9+
{
10+
Text = "Verify DatePicker DateFormat",
11+
AutomationId = "Label",
12+
};
13+
14+
var datePicker = new DatePicker
15+
{
16+
Format = "dd.MM.yyyy",
17+
Date = new DateTime(2022, 2, 25),
18+
};
19+
20+
Content = new StackLayout
21+
{
22+
Children =
23+
{
24+
label,
25+
datePicker
26+
},
27+
};
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#if TEST_FAILS_ON_CATALYST //More Info: https://github.com/dotnet/maui/issues/29099
2+
using NUnit.Framework;
3+
using UITest.Appium;
4+
using UITest.Core;
5+
6+
namespace Microsoft.Maui.TestCases.Tests.Issues;
7+
public class Issue10805 : _IssuesUITest
8+
{
9+
public Issue10805(TestDevice device) : base(device)
10+
{
11+
}
12+
13+
public override string Issue => "Date Format property in DatePicker not working on Windows with date Format";
14+
15+
[Test]
16+
[Category(UITestCategories.DatePicker)]
17+
public void VerifyDatePickerDotBasedDateFormat()
18+
{
19+
App.WaitForElement("Label");
20+
VerifyScreenshot();
21+
}
22+
}
23+
#endif
Loading

src/Core/src/Platform/Windows/CalendarDatePickerExtensions.cs

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ internal static string GetSeparator(string format)
4343
separator = "-";
4444
else if (format.Contains(' ', StringComparison.CurrentCultureIgnoreCase))
4545
separator = " ";
46+
else if (format.Contains('.', StringComparison.CurrentCultureIgnoreCase))
47+
separator = ".";
4648
else
4749
separator = string.Empty;
4850

0 commit comments

Comments
 (0)