Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SashaLexor opened this issue May 15, 2017 · 5 comments
Open

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

SashaLexor opened this issue May 15, 2017 · 5 comments

Comments

@SashaLexor
Copy link

SashaLexor commented May 15, 2017

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
Copy link

+1

@MehulSojitra16
Copy link

MehulSojitra16 commented May 16, 2018

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

@noorulain17
Copy link
Collaborator

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

@tkirby
Copy link

tkirby commented Oct 6, 2020

+1

@skywinder skywinder added bug and removed bug labels Oct 7, 2020
@skywinder
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants