xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] [UWP] Format property of TimePicker not respected on UWP - unable to make a true 24 hour time picker display #11520

Open BurkusCat opened 4 years ago

BurkusCat commented 4 years ago

Description

I am attempting to get a TimePicker on UWP to display a time in the format "09:49" aka 24 hour time. All Windows settings are set correctly to 24 hour clocks, UK locale etc.

Steps to Reproduce

Insert a TimePicker with a custom format property in XAML.

Expected Behavior

The time picker will initialise with current time with a leading 0 in the hours section eg. "04:29". When selecting times from a dropdown, the hours and minutes should have a leading 0 if required.

Actual Behavior

The time picker initialises with the current time but no leading 0 e.g. "4:29" for the morning or "16:29" in the afternoon. It should be "04:29" especially with the custom formatter. Selecting a time from the dropdown, the hours selector does not have a leading 0. The minutes selector does correctly have a leading 0 if necessary.

Basic Information

Screenshots

image

image

image

Reproduction Link

Very simple to reproduce:

<TimePicker
     Format="HH:mm"
     Time="{Binding Time, Mode=TwoWay}" />

Workaround

None

memu8 commented 4 years ago

I just submitted a PR regarding fixing the format property on UWP TimePickers this week. Here is the link if you want to check it out: https://github.com/xamarin/Xamarin.Forms/pull/11474. I hope this resolves your issue! Feel free to respond with any other changes that aren't already being addressed in this PR that you'd like to see regarding UWP TimePickers.