florent37 / SingleDateAndTimePicker

You can now select a date and a time with only one widget !
Apache License 2.0
1.02k stars 333 forks source link

Set defaultDate sets incorrect time #201

Open CarsonRedeye opened 5 years ago

CarsonRedeye commented 5 years ago

Steps to reproduce:

  1. Build the dialog instance with these settings
    .displayHours(true)
    .displayMinutes(true)
    .displayAmPm(false)
    .defaultDate(/* a date with a time of 22:00 */)

    Expected: dialog shows with time set as 22:00 Actual: dialog shows with time set as 10:00

CarsonRedeye commented 5 years ago

I think it could be fixed be reversing the order to setIsAmPm first in SingleDateAndTimePickerDialog:

        if (defaultDate != null) {
            picker.setDefaultDate(defaultDate);
        }

        if (isAmPm != null) {
            picker.setIsAmPm(isAmPm);
        }