bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
54 stars 6 forks source link

Missing type definitions for Duration.add and Duration.diff - Are they private methods? #10341

Open bbkfhq opened 2 days ago

bbkfhq commented 2 days ago

Core/data/Duration.js has two methods called add and diff for adding and subtracting duration objects to and from each other.

However, these methods are not defined on the interface for Duration in @bryntum/gantt/gantt.d.ts.

I'm guessing it's because add and diff are private API?

My use case is: I have effort and actualEffort, and I want to calculate remainingEffort = effort - actualEffort

At the moment I'm relying on a type-cast like this:

(record.fullEffort as any).diff(record.fullActualEffort)

Version: @bryntum/gantt v6.1.2

arcady-zherdev commented 1 day ago

Hello,

Yes the methods don't appear in the Gantt interface file since they are private. We'll consider making the methods public.

Thank you for the report.

P.S. Worth mentioning that those methods could be not correct for the Gantt if using day unit or a greater one. The reason is units conversion - the mentioned methods use DateHelper to convert units while the Gantt overrides duration units on the project level: https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#field-hoursPerDay https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#field-daysPerWeek https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#field-daysPerMonth

But as long as effort is expressed in hours that should not hurt.