From 43c62fd4ddc74e4b2ea1b58e1139e19f76efca04 Mon Sep 17 00:00:00 2001 From: Vegard Date: Fri, 26 Jun 2026 15:18:21 +0200 Subject: [PATCH 1/2] fixed stale datetime picker default value --- .../DateAndTimePicker.Properties.cs | 12 ++++++++---- .../Pickers/DatePicker/DatePicker.Properties.cs | 8 ++++++-- .../HorizontalInlineDatePicker.Properties.cs | 11 +++++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/library/DIPS.Mobile.UI/Components/Pickers/DateAndTimePicker/DateAndTimePicker.Properties.cs b/src/library/DIPS.Mobile.UI/Components/Pickers/DateAndTimePicker/DateAndTimePicker.Properties.cs index 01e3c9099..31818b89e 100644 --- a/src/library/DIPS.Mobile.UI/Components/Pickers/DateAndTimePicker/DateAndTimePicker.Properties.cs +++ b/src/library/DIPS.Mobile.UI/Components/Pickers/DateAndTimePicker/DateAndTimePicker.Properties.cs @@ -8,16 +8,20 @@ public partial class DateAndTimePicker public static readonly BindableProperty SelectedDateTimeProperty = BindableProperty.Create( nameof(SelectedDateTime), typeof(DateTime), - typeof(DateAndTimePicker), - DateTime.Now, + typeof(DateAndTimePicker), + default(DateTime), defaultBindingMode:BindingMode.TwoWay, propertyChanged: (bindable, _, date) => { if(date is not DateTime time) return; - + ((DateAndTimePicker)bindable).OnSelectedDateTimeChanged(time); - }); + }, + // A plain DateTime.Now default value is read only once and then shared by every picker, + // so all pickers showed the same frozen time until app restart. The creator runs once per + // picker, so each picker gets the current time instead. + defaultValueCreator: bindable => DateTime.Now); /// /// The date people selected from the date picker. diff --git a/src/library/DIPS.Mobile.UI/Components/Pickers/DatePicker/DatePicker.Properties.cs b/src/library/DIPS.Mobile.UI/Components/Pickers/DatePicker/DatePicker.Properties.cs index 5b95887db..27e81fa82 100644 --- a/src/library/DIPS.Mobile.UI/Components/Pickers/DatePicker/DatePicker.Properties.cs +++ b/src/library/DIPS.Mobile.UI/Components/Pickers/DatePicker/DatePicker.Properties.cs @@ -60,8 +60,12 @@ public DateTime? MaximumDate typeof(DateTime), typeof(DatePicker), defaultBindingMode:BindingMode.TwoWay, - defaultValue:DateTime.Now, - propertyChanged: (bindable, _, _) => ((DatePicker)bindable).OnSelectedDateChanged()); + defaultValue:default(DateTime), + propertyChanged: (bindable, _, _) => ((DatePicker)bindable).OnSelectedDateChanged(), + // A plain DateTime.Now default value is read only once and then shared by every picker, + // so all pickers showed the same frozen time until app restart. The creator runs once per + // picker, so each picker gets the current time instead. + defaultValueCreator: bindable => DateTime.Now); public static readonly BindableProperty SelectedDateCommandProperty = BindableProperty.Create( nameof(SelectedDateCommand), diff --git a/src/library/DIPS.Mobile.UI/Components/Pickers/DatePicker/HorizontalInLine/HorizontalInlineDatePicker.Properties.cs b/src/library/DIPS.Mobile.UI/Components/Pickers/DatePicker/HorizontalInLine/HorizontalInlineDatePicker.Properties.cs index 06d049a7d..069fb4933 100644 --- a/src/library/DIPS.Mobile.UI/Components/Pickers/DatePicker/HorizontalInLine/HorizontalInlineDatePicker.Properties.cs +++ b/src/library/DIPS.Mobile.UI/Components/Pickers/DatePicker/HorizontalInLine/HorizontalInlineDatePicker.Properties.cs @@ -5,11 +5,18 @@ public partial class HorizontalInlineDatePicker public static readonly BindableProperty SelectedDateProperty = BindableProperty.Create( nameof(SelectedDate), typeof(DateTime), - typeof(HorizontalInlineDatePicker), defaultValue: DateTime.Now, BindingMode.TwoWay, propertyChanged: (b, _, _) => + typeof(HorizontalInlineDatePicker), + defaultValue: default(DateTime), + defaultBindingMode: BindingMode.TwoWay, + propertyChanged: (b, _, _) => { if (b is not HorizontalInlineDatePicker horizontalInlineDatePicker) return; horizontalInlineDatePicker.OnSelectedDateChanged(); - }) ; + }, + // A plain DateTime.Now default value is read only once and then shared by every picker, + // so all pickers showed the same frozen time until app restart. The creator runs once per + // picker, so each picker gets the current time instead. + defaultValueCreator: b => DateTime.Now); /// /// The date that people selected from the horizontal in line date picker. From 5ea966f43fcf10556c7a5d4d842e6c180438797b Mon Sep 17 00:00:00 2001 From: Vegard Date: Fri, 26 Jun 2026 15:24:18 +0200 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c95bdbd5c..24172dedc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [61.5.2] +- [DateAndTimePicker][DatePicker][HorizontalInlineDatePicker] Fixed issue where the default value of pickers with no set value was reused and never updated until restart. + ## [61.5.1] - [Touch][iOS] Fixed scroll gestures on tappable rows getting stuck after dismissing context menus or picker popovers, and prevented taps behind open overlays from activating touch commands.