ActionSheetPicker-3.0 icon indicating copy to clipboard operation
ActionSheetPicker-3.0 copied to clipboard

ActionSheetDatePicker return not correct Date (-1 day)

Open SashaLexor opened this issue 7 years ago • 5 comments

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?

SashaLexor avatar May 15 '17 08:05 SashaLexor

+1

ChristianDeckert avatar Sep 08 '17 09:09 ChristianDeckert

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

MehulSojitra16 avatar May 16 '18 16:05 MehulSojitra16

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

noorulain17 avatar Oct 01 '20 16:10 noorulain17

+1

tkirby avatar Oct 06 '20 07:10 tkirby

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.

skywinder avatar Oct 07 '20 15:10 skywinder