question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Date Format property in DatePicker not working on Windows with date Format

See original GitHub issue

Description

I have defined three DatePickers on a Xaml page. <DatePicker Date="02/25/2022" Format = "dd.mm.yyyy"/> <DatePicker Date="02/25/2022" Format = "dd/mm/yyyy"/> <DatePicker Date="02/25/2022" Format = "mm/dd/yyyy"/>

This is shown like that on Windows. The french format “mm/dd/yyyy” is ocrrect but the German is showing only the day. On Android the month is set to 0.

image And like that on an Android Phone image

I had expected to see the controls showing three different date formats but this is not the case. I also tried to set the date format in code behind using the formats from CultureInfo.CurrentCulture.DateTimeFormat but this did not work either.

A similar problem was discussed in issue #7972

Steps to Reproduce

Create a new .NET MAUI app Add a DatePicker to the app with the format set to the German format. The separator is a ". here. <DatePicker Date="02/25/2022" Format = "dd.mm.yyyy"/> <DatePicker Date="02/25/2022" Format = "dd/mm/yyyy"/> <DatePicker Date="02/25/2022" Format = "mm/dd/yyyy"/>

Link to public reproduction project repository

https://github.com/FrankPohl/DatePickerError

Version with bug

6.0.400

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows

Affected platform versions

Windows SDK 10.0.19041.0 and Android Framework 29.0

Did you find any workaround?

No

Relevant log output

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:10

github_iconTop GitHub Comments

3reactions
MatthewB05commented, Oct 25, 2022

In fact it’s not just the date format that’s broken, the entire control is ignoring regional settings on windows - the day/month names are in English and the week starting dates are all out by one day. On Android these are both correct.

image

1reaction
pockicommented, Mar 18, 2023

The weekdays and months also wrong (english in my case) even if you set the language handler.PlatformView.Language in @MatthewB05 workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jquery datepicker format date not working
This is working. Try just format option not dateFormat. Because due to different version of datepicker. – shiv. Sep 25, 2020 at 6:24....
Read more >
Solved: Date format incorrect from date picker
I recently posted a query regarding replacing the default date picker so that the user didn't have to click the OK button:.
Read more >
DateTimePicker.CustomFormat Property
The Format property must be set to DateTimePickerFormat.Custom for this property to affect the formatting of the displayed date and time. The following...
Read more >
Display a Date in a Custom Format with DateTimePicker ...
Set the Format property to DateTimePickerFormat.Custom . Set the CustomFormat property to a format string.
Read more >
WPF DatePicker dateformat change issue - Microsoft Q&A
Hi , i have used a datepicker inside my code . I want the format as dd/MM/yyyy but i am getting it always...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found