gantt-lib 0.115.1 → 0.115.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -32,6 +32,11 @@ declare const getDayOffset: (date: Date, monthStart: Date) => number;
32
32
  * @returns True if date is today, false otherwise
33
33
  */
34
34
  declare const isToday: (date: Date) => boolean;
35
+ /**
36
+ * Returns the user's current local calendar day normalized into a UTC date-only value.
37
+ * Example: for 2026-05-16 00:10 at UTC+03:00 this returns 2026-05-16T00:00:00.000Z.
38
+ */
39
+ declare const getTodayLocalUtcDate: (referenceDate?: Date) => Date;
35
40
  /**
36
41
  * Check if date is a weekend day (Saturday or Sunday)
37
42
  * @param date - Date to check
@@ -1501,4 +1506,4 @@ interface ResourceTimelineLayoutResult<TItem extends ResourceTimelineItem = Reso
1501
1506
  }
1502
1507
  declare const layoutResourceTimelineItems: <TItem extends ResourceTimelineItem = ResourceTimelineItem>(resources: Array<ResourceTimelineResource<TItem>>, options: ResourceTimelineLayoutOptions) => ResourceTimelineLayoutResult<TItem>;
1503
1508
 
1504
- export { type BuiltInTaskListColumnId, Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, type ExportToPdfHeaderOptions, type ExportToPdfOptions, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttModeProps, GridBackground, Input, type InputProps, type MonthBlock, type PlanFactCellCommitContext, type PlanFactCellKind, PlanFactMatrix, type PlanFactModeProps, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, type ReorderDropPlacement, type ReorderDropTarget, ResourcePlannerChartProps, ResourceTimelineChart, type ResourceTimelineConflictRange, ResourceTimelineItem, type ResourceTimelineLayoutDiagnostic, type ResourceTimelineLayoutItem, type ResourceTimelineLayoutOptions, type ResourceTimelineLayoutResult, type ResourceTimelineLayoutRow, ResourceTimelineResource, TableMatrix, type TableMatrixCellClickContext, type TableMatrixColumn, type TableMatrixColumnGroup, type TableMatrixDateOverlay, type TableMatrixModeProps, type Task, TaskDateChangeMode, type TaskDependency, TaskList, type TaskListColumn, type TaskListColumnContext, type TaskListColumnId, type TaskListColumnWidthMap, type TaskListMenuCommand, type TaskListProps, type TaskPredicate, TaskRow, TimeScaleHeader, TimelineMarker, TodayIndicator, ValidationResult, type VisibleReorderPlan, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WithoutDepsOptions, type YearSpan, addBusinessDays, and, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMilestoneConnectionBounds, calculateMilestoneGeometry, calculateMonthGridLines, calculateOrthogonalPath, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, clampDateRangeForIncomingFS, createCustomDayPredicate, createDateKey, detectEdgeZone, expired, flattenHierarchy, formatDateLabel, formatDateRangeLabel, getBusinessDaysCount, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getVisibleReorderPlan, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, inDateRange, isTaskExpired, isToday, isWeekend, layoutResourceTimelineItems, nameContains, normalizeHierarchyTasks, normalizeTaskDates, not, or, parseUTCDate, pixelsToDate, progressInRange, resolveDateRangeFromPixels, resolveTaskHorizontalGeometry, subtractBusinessDays, useTaskDrag, withoutDeps };
1509
+ export { type BuiltInTaskListColumnId, Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, type ExportToPdfHeaderOptions, type ExportToPdfOptions, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttModeProps, GridBackground, Input, type InputProps, type MonthBlock, type PlanFactCellCommitContext, type PlanFactCellKind, PlanFactMatrix, type PlanFactModeProps, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, type ReorderDropPlacement, type ReorderDropTarget, ResourcePlannerChartProps, ResourceTimelineChart, type ResourceTimelineConflictRange, ResourceTimelineItem, type ResourceTimelineLayoutDiagnostic, type ResourceTimelineLayoutItem, type ResourceTimelineLayoutOptions, type ResourceTimelineLayoutResult, type ResourceTimelineLayoutRow, ResourceTimelineResource, TableMatrix, type TableMatrixCellClickContext, type TableMatrixColumn, type TableMatrixColumnGroup, type TableMatrixDateOverlay, type TableMatrixModeProps, type Task, TaskDateChangeMode, type TaskDependency, TaskList, type TaskListColumn, type TaskListColumnContext, type TaskListColumnId, type TaskListColumnWidthMap, type TaskListMenuCommand, type TaskListProps, type TaskPredicate, TaskRow, TimeScaleHeader, TimelineMarker, TodayIndicator, ValidationResult, type VisibleReorderPlan, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WithoutDepsOptions, type YearSpan, addBusinessDays, and, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMilestoneConnectionBounds, calculateMilestoneGeometry, calculateMonthGridLines, calculateOrthogonalPath, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, clampDateRangeForIncomingFS, createCustomDayPredicate, createDateKey, detectEdgeZone, expired, flattenHierarchy, formatDateLabel, formatDateRangeLabel, getBusinessDaysCount, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getTodayLocalUtcDate, getVisibleReorderPlan, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, inDateRange, isTaskExpired, isToday, isWeekend, layoutResourceTimelineItems, nameContains, normalizeHierarchyTasks, normalizeTaskDates, not, or, parseUTCDate, pixelsToDate, progressInRange, resolveDateRangeFromPixels, resolveTaskHorizontalGeometry, subtractBusinessDays, useTaskDrag, withoutDeps };
package/dist/index.d.ts CHANGED
@@ -32,6 +32,11 @@ declare const getDayOffset: (date: Date, monthStart: Date) => number;
32
32
  * @returns True if date is today, false otherwise
33
33
  */
34
34
  declare const isToday: (date: Date) => boolean;
35
+ /**
36
+ * Returns the user's current local calendar day normalized into a UTC date-only value.
37
+ * Example: for 2026-05-16 00:10 at UTC+03:00 this returns 2026-05-16T00:00:00.000Z.
38
+ */
39
+ declare const getTodayLocalUtcDate: (referenceDate?: Date) => Date;
35
40
  /**
36
41
  * Check if date is a weekend day (Saturday or Sunday)
37
42
  * @param date - Date to check
@@ -1501,4 +1506,4 @@ interface ResourceTimelineLayoutResult<TItem extends ResourceTimelineItem = Reso
1501
1506
  }
1502
1507
  declare const layoutResourceTimelineItems: <TItem extends ResourceTimelineItem = ResourceTimelineItem>(resources: Array<ResourceTimelineResource<TItem>>, options: ResourceTimelineLayoutOptions) => ResourceTimelineLayoutResult<TItem>;
1503
1508
 
1504
- export { type BuiltInTaskListColumnId, Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, type ExportToPdfHeaderOptions, type ExportToPdfOptions, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttModeProps, GridBackground, Input, type InputProps, type MonthBlock, type PlanFactCellCommitContext, type PlanFactCellKind, PlanFactMatrix, type PlanFactModeProps, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, type ReorderDropPlacement, type ReorderDropTarget, ResourcePlannerChartProps, ResourceTimelineChart, type ResourceTimelineConflictRange, ResourceTimelineItem, type ResourceTimelineLayoutDiagnostic, type ResourceTimelineLayoutItem, type ResourceTimelineLayoutOptions, type ResourceTimelineLayoutResult, type ResourceTimelineLayoutRow, ResourceTimelineResource, TableMatrix, type TableMatrixCellClickContext, type TableMatrixColumn, type TableMatrixColumnGroup, type TableMatrixDateOverlay, type TableMatrixModeProps, type Task, TaskDateChangeMode, type TaskDependency, TaskList, type TaskListColumn, type TaskListColumnContext, type TaskListColumnId, type TaskListColumnWidthMap, type TaskListMenuCommand, type TaskListProps, type TaskPredicate, TaskRow, TimeScaleHeader, TimelineMarker, TodayIndicator, ValidationResult, type VisibleReorderPlan, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WithoutDepsOptions, type YearSpan, addBusinessDays, and, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMilestoneConnectionBounds, calculateMilestoneGeometry, calculateMonthGridLines, calculateOrthogonalPath, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, clampDateRangeForIncomingFS, createCustomDayPredicate, createDateKey, detectEdgeZone, expired, flattenHierarchy, formatDateLabel, formatDateRangeLabel, getBusinessDaysCount, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getVisibleReorderPlan, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, inDateRange, isTaskExpired, isToday, isWeekend, layoutResourceTimelineItems, nameContains, normalizeHierarchyTasks, normalizeTaskDates, not, or, parseUTCDate, pixelsToDate, progressInRange, resolveDateRangeFromPixels, resolveTaskHorizontalGeometry, subtractBusinessDays, useTaskDrag, withoutDeps };
1509
+ export { type BuiltInTaskListColumnId, Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, type ExportToPdfHeaderOptions, type ExportToPdfOptions, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttModeProps, GridBackground, Input, type InputProps, type MonthBlock, type PlanFactCellCommitContext, type PlanFactCellKind, PlanFactMatrix, type PlanFactModeProps, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, type ReorderDropPlacement, type ReorderDropTarget, ResourcePlannerChartProps, ResourceTimelineChart, type ResourceTimelineConflictRange, ResourceTimelineItem, type ResourceTimelineLayoutDiagnostic, type ResourceTimelineLayoutItem, type ResourceTimelineLayoutOptions, type ResourceTimelineLayoutResult, type ResourceTimelineLayoutRow, ResourceTimelineResource, TableMatrix, type TableMatrixCellClickContext, type TableMatrixColumn, type TableMatrixColumnGroup, type TableMatrixDateOverlay, type TableMatrixModeProps, type Task, TaskDateChangeMode, type TaskDependency, TaskList, type TaskListColumn, type TaskListColumnContext, type TaskListColumnId, type TaskListColumnWidthMap, type TaskListMenuCommand, type TaskListProps, type TaskPredicate, TaskRow, TimeScaleHeader, TimelineMarker, TodayIndicator, ValidationResult, type VisibleReorderPlan, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WithoutDepsOptions, type YearSpan, addBusinessDays, and, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMilestoneConnectionBounds, calculateMilestoneGeometry, calculateMonthGridLines, calculateOrthogonalPath, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, clampDateRangeForIncomingFS, createCustomDayPredicate, createDateKey, detectEdgeZone, expired, flattenHierarchy, formatDateLabel, formatDateRangeLabel, getBusinessDaysCount, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getTodayLocalUtcDate, getVisibleReorderPlan, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, inDateRange, isTaskExpired, isToday, isWeekend, layoutResourceTimelineItems, nameContains, normalizeHierarchyTasks, normalizeTaskDates, not, or, parseUTCDate, pixelsToDate, progressInRange, resolveDateRangeFromPixels, resolveTaskHorizontalGeometry, subtractBusinessDays, useTaskDrag, withoutDeps };
package/dist/index.js CHANGED
@@ -99,6 +99,7 @@ __export(index_exports, {
99
99
  getMultiMonthDays: () => getMultiMonthDays,
100
100
  getSuccessorChain: () => getSuccessorChain,
101
101
  getTaskDuration: () => getTaskDuration,
102
+ getTodayLocalUtcDate: () => getTodayLocalUtcDate,
102
103
  getTransitiveCascadeChain: () => getTransitiveCascadeChain,
103
104
  getVisibleReorderPlan: () => getVisibleReorderPlan,
104
105
  getVisibleReorderPosition: () => getVisibleReorderPosition,
@@ -284,12 +285,7 @@ var getDayOffset = (date, monthStart) => {
284
285
  return Math.round((dateMs - startMs) / (1e3 * 60 * 60 * 24));
285
286
  };
286
287
  var isToday = (date) => {
287
- const now = /* @__PURE__ */ new Date();
288
- const today = new Date(Date.UTC(
289
- now.getFullYear(),
290
- now.getMonth(),
291
- now.getDate()
292
- ));
288
+ const today = getTodayLocalUtcDate();
293
289
  const compareDate = new Date(Date.UTC(
294
290
  date.getUTCFullYear(),
295
291
  date.getUTCMonth(),
@@ -297,6 +293,13 @@ var isToday = (date) => {
297
293
  ));
298
294
  return today.getTime() === compareDate.getTime();
299
295
  };
296
+ var getTodayLocalUtcDate = (referenceDate = /* @__PURE__ */ new Date()) => {
297
+ return new Date(Date.UTC(
298
+ referenceDate.getFullYear(),
299
+ referenceDate.getMonth(),
300
+ referenceDate.getDate()
301
+ ));
302
+ };
300
303
  var isWeekend = (date) => {
301
304
  const day = date.getUTCDay();
302
305
  return day === 0 || day === 6;
@@ -1729,6 +1732,7 @@ var TimeScaleHeader = ({
1729
1732
  onTimelineHover,
1730
1733
  onTimelineHoverEnd
1731
1734
  }) => {
1735
+ const today = (0, import_react.useMemo)(() => getTodayLocalUtcDate(), []);
1732
1736
  const monthSpans = (0, import_react.useMemo)(() => getMonthSpans(days), [days]);
1733
1737
  const rowHeight = headerHeight / 2;
1734
1738
  const dayGridTemplate = (0, import_react.useMemo)(
@@ -1905,8 +1909,7 @@ var TimeScaleHeader = ({
1905
1909
  const isWeekendDay = isCustomWeekend ? isCustomWeekend(day) : day.getUTCDay() === 0 || day.getUTCDay() === 6;
1906
1910
  const prevDay = days[index - 1];
1907
1911
  const isMonthBoundary = index > 0 && prevDay && prevDay.getUTCMonth() !== day.getUTCMonth();
1908
- const now = /* @__PURE__ */ new Date();
1909
- const isTodayDate = day.getUTCFullYear() === now.getFullYear() && day.getUTCMonth() === now.getMonth() && day.getUTCDate() === now.getDate();
1912
+ const isTodayDate = day.getUTCFullYear() === today.getUTCFullYear() && day.getUTCMonth() === today.getUTCMonth() && day.getUTCDate() === today.getUTCDate();
1910
1913
  const markerKey = `${day.getUTCFullYear()}-${day.getUTCMonth()}-${day.getUTCDate()}`;
1911
1914
  const marker = markerByDayKey.get(markerKey);
1912
1915
  const markerColor = marker?.color;
@@ -3268,12 +3271,7 @@ var TaskRow_default = TaskRow;
3268
3271
  var import_react4 = require("react");
3269
3272
  var import_jsx_runtime3 = require("react/jsx-runtime");
3270
3273
  var TodayIndicator = ({ monthStart, dayWidth, onHover, onHoverEnd }) => {
3271
- const today = /* @__PURE__ */ new Date();
3272
- const todayLocal = new Date(Date.UTC(
3273
- today.getFullYear(),
3274
- today.getMonth(),
3275
- today.getDate()
3276
- ));
3274
+ const todayLocal = getTodayLocalUtcDate();
3277
3275
  const position = (0, import_react4.useMemo)(() => {
3278
3276
  const offset = getDayOffset(todayLocal, monthStart);
3279
3277
  return Math.round(offset * dayWidth);
@@ -9602,8 +9600,7 @@ function ResourceTimelineChart({
9602
9600
  };
9603
9601
  }, [collapsedResourceGroups, creatingResourceGroupType, layout, resourceAddRowHeight, resourceGrouping]);
9604
9602
  const todayInRange = (0, import_react15.useMemo)(() => {
9605
- const now = /* @__PURE__ */ new Date();
9606
- const today = new Date(Date.UTC(now.getFullYear(), now.getMonth(), now.getDate()));
9603
+ const today = getTodayLocalUtcDate();
9607
9604
  return dateRange.some((day) => day.getTime() === today.getTime());
9608
9605
  }, [dateRange]);
9609
9606
  const itemsByResourceId = (0, import_react15.useMemo)(() => {
@@ -12275,8 +12272,7 @@ function TaskGanttChartInner(props, ref) {
12275
12272
  return new Date(Date.UTC(firstDay.getUTCFullYear(), firstDay.getUTCMonth(), 1));
12276
12273
  }, [dateRange]);
12277
12274
  const todayIndex = (0, import_react18.useMemo)(() => {
12278
- const now = /* @__PURE__ */ new Date();
12279
- const today = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
12275
+ const today = getTodayLocalUtcDate();
12280
12276
  return dateRange.findIndex((day) => day.getTime() === today.getTime());
12281
12277
  }, [dateRange]);
12282
12278
  const todayInRange = todayIndex !== -1;
@@ -12296,8 +12292,7 @@ function TaskGanttChartInner(props, ref) {
12296
12292
  if (hasAutoScrolledToTodayRef.current) return;
12297
12293
  const container = scrollContainerRef.current;
12298
12294
  if (!container || dateRange.length === 0) return;
12299
- const now = /* @__PURE__ */ new Date();
12300
- const today = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
12295
+ const today = getTodayLocalUtcDate();
12301
12296
  const todayIndex2 = dateRange.findIndex((day) => day.getTime() === today.getTime());
12302
12297
  if (todayIndex2 === -1) return;
12303
12298
  const todayOffset = todayIndex2 * dayWidth;
@@ -12366,8 +12361,7 @@ function TaskGanttChartInner(props, ref) {
12366
12361
  if (isTableMatrixMode) return;
12367
12362
  const container = scrollContainerRef.current;
12368
12363
  if (!container || dateRange.length === 0) return;
12369
- const now = /* @__PURE__ */ new Date();
12370
- const today = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
12364
+ const today = getTodayLocalUtcDate();
12371
12365
  const todayIndex2 = dateRange.findIndex((day) => day.getTime() === today.getTime());
12372
12366
  if (todayIndex2 === -1) return;
12373
12367
  const todayOffset = todayIndex2 * dayWidth;
@@ -13350,6 +13344,7 @@ var nameContains = (substring, caseSensitive = false) => (task) => {
13350
13344
  getMultiMonthDays,
13351
13345
  getSuccessorChain,
13352
13346
  getTaskDuration,
13347
+ getTodayLocalUtcDate,
13353
13348
  getTransitiveCascadeChain,
13354
13349
  getVisibleReorderPlan,
13355
13350
  getVisibleReorderPosition,