Updated logic for add and editing task with custom duration.