skywinder / ActionSheetPicker-3.0

Quickly reproduce the dropdown UIPickerView / ActionSheet functionality on iOS.
http://skywinder.github.io/ActionSheetPicker-3.0
BSD 3-Clause "New" or "Revised" License
3.4k stars 740 forks source link

ActionSheetDatePicker return not correct Date (-1 day) #346

Open SashaLexor opened 7 years ago

SashaLexor commented 7 years ago

ActionSheetDatePicker return not correct Date (-1 day) My code:

let picker = ActionSheetDatePicker.show(withTitle: title, datePickerMode: .date, selectedDate: value ?? maximumDate ?? Date(), minimumDate: minimumDate, maximumDate: maximumDate, doneBlock: {
            [weak self] _, date, origin in

            // !!! ----- RETURN DATE -1 DAY -----

            if let date = date as? Date {
                self?.value = date
                completed(date) 
            } else {
                completed(nil)
            }
        }, cancel: {
            _ in

            completed(nil)
        }, origin: origin)

        self.picker = nil
        if let picker = picker {
            self.picker = picker
        } else {
            completed(nil)
        }

Why that happens an how to fix that?

ChristianDeckert commented 7 years ago

+1

MehulSojitra16 commented 6 years ago

Same here. Is there an any solution? If I convert to string than display correct.

noorulain17 commented 4 years ago

@MehulSojitra16 / @SashaLexor / @ChristianDeckert do you guys still face this issue on the latest version?

tkirby commented 4 years ago

+1

skywinder commented 4 years ago

As I remember it happens when picker doesnt stop completley and you press done. It's standart behaviour of native picker, so we can't change it in the library.