     }
     
     func datePickerValueChange(_ sender: UIDatePicker) {
-        let dateString = Utils.stringFrom(date: sender.date, startDate: startDateEditing, longFormat: longDateFormat)
-        if startDateEditing {
+        let dateString = Utils.stringFrom(date: sender.date, startDate: editingStartDate, longFormat: longDateFormat)
+        if editingStartDate {
             startDate = sender.date
             startDateTextField.text = dateString
         } else {

    
    var editItem: Item?
    
    var startDateEditing = false
    
    var startDate: Date!
    var endDate: Date!

    }
    
    @IBAction func startDateEditing(_ sender: UITextField) {
        editingStartDate = true
        
        let (minDate, _) = minMaxDate
        
