Skip to content

Commit

Permalink
chore: native timepicker- set -initial time
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunal22shah committed Nov 28, 2024
1 parent dabd0a6 commit 8d2813c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private protected override void OnLoaded()
public void Initialize()
{
SaveInitialTime();
SetPickerTime(Time);
SetPickerTime(Time == default ? DateTime.Now.TimeOfDay : Time);
SetPickerClockIdentifier(ClockIdentifier);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ private protected override void OnLoaded()

UpdatePickerStyle();
DatePickerSelector.OverrideUIDatePickerTheme(this);
SetPickerTime(Time.RoundToNextMinuteInterval(MinuteIncrement));

// Set the default time to current time if no time is set
var initialTime = Time == default ? DateTime.Now.TimeOfDay : Time;
SetPickerTime(initialTime.RoundToNextMinuteInterval(MinuteIncrement));
SetPickerClockIdentifier(ClockIdentifier);
SaveInitialTime();
_picker.ValueChanged += OnValueChanged;
Expand Down

0 comments on commit 8d2813c

Please sign in to comment.