Skip to content

Commit 6b6d24b

Browse files
committed
Simple UseSeconds fix
1 parent e3c6418 commit 6b6d24b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

samples/Sandbox/MainWindow.axaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<Window xmlns="https://github.com/avaloniaui"
22
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
33
x:Class="Sandbox.MainWindow">
4+
<StackPanel>
5+
<TimePicker x:Name="Picker" />
6+
<TextBlock Text="{Binding #Picker.SelectedTime}" />
7+
<CheckBox IsChecked="{Binding #Picker.UseSeconds}" />
8+
</StackPanel>
49
</Window>

src/Avalonia.Controls/DateTimePickers/TimePickerPresenter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ protected override void OnConfirmed()
241241
hr = per == 1 ? (hr == 12) ? 12 : hr + 12 : per == 0 && hr == 12 ? 0 : hr;
242242
}
243243

244-
SetCurrentValue(TimeProperty, new TimeSpan(hr, min, sec));
244+
SetCurrentValue(TimeProperty, new TimeSpan(hr, min, UseSeconds ? sec : 0));
245245

246246
base.OnConfirmed();
247247
}

0 commit comments

Comments
 (0)