I have a date and time picker that I'm trying to use to set a global variable varStartTime. When PM is selected, I would like to advance the time by 12 hours so that it reflects PM. However, I am experiencing a bug I just cannot wrap my head around. Here is my code in the OnSelect and OnChange of all of the controls:
Set(varStartTime,
DateTime(
Year(DateStart.SelectedDate),
Month(DateStart.SelectedDate),
Day(DateStart.SelectedDate),
If(StartTimeAMPM.Selected.Value = "PM", StartTimeHour.SelectedText.Value + 12, StartTimeHour.SelectedText.Value),
StartTimeMinute.SelectedText.Value, 0));
Here is my date and time picker:

Below the time is the global variable in a text box for testing. As you can see, the variable has a PM value, even though the dropdown shows AM. It only happens when the hour field is set to 12. I'm missing something obvious and I've looked at it too long so any help is appreciated. Thanks.