                 }
             }
         } else if let tableView = scrollView as? UITableView {
-            let relativeOffset = CGPoint(x: 0, y: tableView.contentOffset.y + tableView.contentInset.top)
-            var row = round(relativeOffset.y / tableView.rowHeight)
-            if tableView == hourTableView {
-                row = max(min(row, 23), 0)
-            } else if tableView == minuteTableView {
-                row = max(min(row, 59), 0)
-            }
+            let relativeOffset = CGPoint(x: 0, y: tableView.contentOffset.y + tableView.contentInset.top )
+            // change row from var to let.
+            let row = round(relativeOffset.y / tableView.rowHeight)
+            // table view became infinite, so do not need this code anymore.
+//            if tableView == hourTableView {
+//                row = max(min(row, 23), 0)
+//            } else if tableView == minuteTableView {
+//                row = max(min(row, 59), 0)
+//            }
             tableView.selectRow(at: IndexPath(row: Int(row), section: 0), animated: true, scrollPosition: .middle)
             
+            // add 24 to hour and 60 to minute, because datasource now has buffer at top and bottom.
             if tableView == hourTableView {
-                components.hour = Int(row)
+                components.hour = Int(row - 24)
             } else if tableView == minuteTableView {
-                components.minute = Int(row)
+                components.minute = Int(row - 60)
             }
             
             if let selected = calendar.date(from: components) {

    internal var calendar: Calendar = .current
    internal var dates: [Date]! = []
    internal var components: DateComponents! {
        didSet {
            if let hour = components.hour {
                hourTableView.selectRow(at: IndexPath(row: hour, section: 0), animated: true, scrollPosition: .middle)
            }
            
            if let minute = components.minute {
                minuteTableView.selectRow(at: IndexPath(row: minute, section: 0), animated: true, scrollPosition: .middle)
            }
        }
    }

    
    public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        if tableView == hourTableView {
            // need triple of origin storage to scroll infinitely
            return 24 * 3
        }
        // need triple of origin storage to scroll infinitely
        return 60 * 3
    }
    
    public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
