       assert(timeType != .none)
       selector = UISegmentedControl(items: [Loc.Now, Loc.LeaveAt, Loc.ArriveBy])
       selector.addTarget(self, action: #selector(timeSelectorChanged(sender:)), for: .valueChanged)
-      self.timeTypeSelector = selector
       
       // this sets the selected section index
       self.selectedTimeType = timeType

    toolbar.backgroundColor = self.backgroundColor
    addSubview(toolbar)
    
    self.frame = .init(x: 0, y: 0, width: timePicker.frame.width, height: timePicker.frame.height + toolbar.frame.height)
  }
  

    case .time, .date:
      selector = UISegmentedControl(items: [Loc.Now])
      selector.addTarget(self, action: #selector(timeSelectorChanged(sender:)), for: .valueChanged)
    }
    
    // Yes, a segmented control with one element. This is for consistent styling.
    let doneSelector = UISegmentedControl(items: [Loc.Done])
    doneSelector.addTarget(self, action: #selector(doneButtonPressed(sender:)), for: .valueChanged)
    
    let toolbar = UIToolbar(frame: .init(x: 0, y: 0, width: timePicker.frame.width, height: 44))
    toolbar.autoresizingMask = .flexibleWidth
    toolbar.items = [
      selector.map(UIBarButtonItem.init(customView:)),
      UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil),
      UIBarButtonItem(customView: doneSelector)
    ].compactMap { $0 }
