squimer / DatePickerDialog-iOS-Swift

Date picker dialog for iOS
MIT License
581 stars 177 forks source link

Date Picker is returning n-5 hours #30

Closed UmarJamil closed 7 years ago

UmarJamil commented 7 years ago

Date Picker is returning n-5 hours

lfarah commented 7 years ago

Hmm, interesting. I'm geting n+7 hours

screen shot 2016-09-07 at 9 36 20 am screen shot 2016-09-07 at 9 36 24 am
lfarah commented 7 years ago

@viniciussoares do you have any idea on how this works?

lfarah commented 7 years ago

I found the problem. When using NSDate, you have to use a NSDateFormatter to convert it to string:

                let formatter = NSDateFormatter()
                formatter.dateFormat = "yyyy-MM-dd HH:mm"

                self.textField.text = "\(formatter.stringFromDate(date))"
viniciussoares commented 7 years ago

@lfarah sorry for the delayed response, i was on vacation. :sweat_smile:

lfarah commented 7 years ago

No problem. You deserve to rest for a bit!