title: ios swift datepicker done button, wrong date with interval
body: <p>I have set up a date picker as input view of a textfield. Date picker has a minimum date and interval minute of 15. Now it gives proper date on changing the spin in value changed delegate. But if I don't spin the picker and tap done button with default first selected, it gives only current date. I would expect it to give me the date which is displayed by default in picker. Here is the code:</p>
  
  <pre><code>class ViewController: UIViewController {
  
      @IBOutlet weak var timeField: UITextField!
  
      var datePicker:UIDatePicker!
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
      }
  
      @IBAction func CallPicker(sender: UITextField) {
  
          let datePickerView:UIDatePicker = UIDatePicker()
          datePickerView.datePickerMode = UIDatePickerMode.DateAndTime
          datePickerView.minuteInterval = 15
          datePickerView.minimumDate = NSDate()
          datePicker = datePickerView
  
          let toolBar = UIToolbar()
          toolBar.sizeToFit()
          let spaceButton = UIBarButtonItem(barButtonSystemItem: .FlexibleSpace, target: nil, action: nil)
          let doneButton = UIBarButtonItem(title: "Done", style: .Plain, target: self, action: "doneTapped")
          toolBar.setItems([spaceButton, doneButton], animated: false)
          toolBar.userInteractionEnabled = true
  
          sender.inputView = datePickerView
          sender.inputAccessoryView = toolBar
          datePickerView.addTarget(self, action: Selector("datePickerValueChanged:"), forControlEvents: UIControlEvents.ValueChanged)
      }
  
      func doneTapped() {
          let dateFormatter = NSDateFormatter()
          dateFormatter.dateStyle = .MediumStyle
          dateFormatter.timeStyle = .MediumStyle
          timeField.text = dateFormatter.stringFromDate(datePicker.date)
          timeField.resignFirstResponder()
      }
  
      func datePickerValueChanged(sender: UIDatePicker) {
          let dateFormatter = NSDateFormatter()
          dateFormatter.dateStyle = .MediumStyle
          dateFormatter.timeStyle = .MediumStyle
          timeField.text = dateFormatter.stringFromDate(sender.date)
      }
  
  }
  </code></pre>
  
  <p>Scenario: suppose its 8:42 now. Date picker will show 8:30 as first entry but when I tap on done button, it will only give current time which is 8:42. However it works well if I roll spin and get back to first entry.</p>