Skip to content

Task length differs for "start+stop" and "start+duration" #4

@TimoL

Description

@TimoL

Creating a task using start and stop parameters should result in the same result as using start and duration parameter.

Reproducer:

gantt_project = gantt.Project()

task_start = date(2021, 1, 1)
task_stop = date(2021, 7, 31)
task_duration = (task_stop - task_start).days

# this prints "2021-07-31 - 2021-01-01 = 211 days"
print(f'{task_stop} - {task_start} = {task_duration} days')

task1 = gantt.Task(name='ok', start=task_start, stop=task_stop)
task2 = gantt.Task(name='too long', start=task_start, duration=task_duration)

gantt_project.add_task(task1)
gantt_project.add_task(task2)

gantt_project.make_svg_for_tasks(
    filename='outfile.svg',
    today=date.today(),
    start=date(2021, 6, 1),
    end=date(2022, 3, 31),
    scale='w'
)

Result:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions