                         last_task = task
                     final_entries.push {active, task, date}
 
+
             # Calculating duration
             for e,i in final_entries
                 next_entry = final_entries[i+1]
                 if next_entry?
                     e.delta = next_entry.date - e.date
                 else
-                    e.delta = Date.now() - e.date
+                    e.delta = date_now - e.date
+
+            first_date = final_entries[0].date
+            min_date_to = Math.max first_date, @state.date_from
+            max_date_from = Math.min date_now, @state.date_to
+
+            f_min_date_from = new Date(first_date).toJSON().split('T')[0]
+            f_max_date_from = new Date(max_date_from).toJSON().split('T')[0]
+            f_min_date_to = new Date(min_date_to).toJSON().split('T')[0]
+            f_max_date_to = new Date(date_now).toJSON().split('T')[0]
 
             div
                 id: 'main_container'

                    # overflowX: 'hidden'
                    WebkitAppRegion: 'drag'
                ]
                for {active, delta, task, date} in final_entries
                    div
                        className: 'entry'
                        style: [

            last_valid_task = null
            last_task = null

            date_now = Date.now()
            # Filling undefined active task and combining entries with adjacent with same task
            for {active, task, date}, i in log.entries
                new_entry = false
                # skiping pauses with duration < 5 min
                if not active and ((log.entries[i + 1]?.date or date_now) - date) < 300000
                    active = true
                if active
                    task = log.get_next_task i
                if active != last_was_active or last_task != task
