gantt-lib 0.115.0 → 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.css.map +1 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +17 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -22
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +2 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -142,12 +142,7 @@ var getDayOffset = (date, monthStart) => {
|
|
|
142
142
|
return Math.round((dateMs - startMs) / (1e3 * 60 * 60 * 24));
|
|
143
143
|
};
|
|
144
144
|
var isToday = (date) => {
|
|
145
|
-
const
|
|
146
|
-
const today = new Date(Date.UTC(
|
|
147
|
-
now.getFullYear(),
|
|
148
|
-
now.getMonth(),
|
|
149
|
-
now.getDate()
|
|
150
|
-
));
|
|
145
|
+
const today = getTodayLocalUtcDate();
|
|
151
146
|
const compareDate = new Date(Date.UTC(
|
|
152
147
|
date.getUTCFullYear(),
|
|
153
148
|
date.getUTCMonth(),
|
|
@@ -155,6 +150,13 @@ var isToday = (date) => {
|
|
|
155
150
|
));
|
|
156
151
|
return today.getTime() === compareDate.getTime();
|
|
157
152
|
};
|
|
153
|
+
var getTodayLocalUtcDate = (referenceDate = /* @__PURE__ */ new Date()) => {
|
|
154
|
+
return new Date(Date.UTC(
|
|
155
|
+
referenceDate.getFullYear(),
|
|
156
|
+
referenceDate.getMonth(),
|
|
157
|
+
referenceDate.getDate()
|
|
158
|
+
));
|
|
159
|
+
};
|
|
158
160
|
var isWeekend = (date) => {
|
|
159
161
|
const day = date.getUTCDay();
|
|
160
162
|
return day === 0 || day === 6;
|
|
@@ -1587,6 +1589,7 @@ var TimeScaleHeader = ({
|
|
|
1587
1589
|
onTimelineHover,
|
|
1588
1590
|
onTimelineHoverEnd
|
|
1589
1591
|
}) => {
|
|
1592
|
+
const today = useMemo(() => getTodayLocalUtcDate(), []);
|
|
1590
1593
|
const monthSpans = useMemo(() => getMonthSpans(days), [days]);
|
|
1591
1594
|
const rowHeight = headerHeight / 2;
|
|
1592
1595
|
const dayGridTemplate = useMemo(
|
|
@@ -1763,8 +1766,7 @@ var TimeScaleHeader = ({
|
|
|
1763
1766
|
const isWeekendDay = isCustomWeekend ? isCustomWeekend(day) : day.getUTCDay() === 0 || day.getUTCDay() === 6;
|
|
1764
1767
|
const prevDay = days[index - 1];
|
|
1765
1768
|
const isMonthBoundary = index > 0 && prevDay && prevDay.getUTCMonth() !== day.getUTCMonth();
|
|
1766
|
-
const
|
|
1767
|
-
const isTodayDate = day.getUTCFullYear() === now.getFullYear() && day.getUTCMonth() === now.getMonth() && day.getUTCDate() === now.getDate();
|
|
1769
|
+
const isTodayDate = day.getUTCFullYear() === today.getUTCFullYear() && day.getUTCMonth() === today.getUTCMonth() && day.getUTCDate() === today.getUTCDate();
|
|
1768
1770
|
const markerKey = `${day.getUTCFullYear()}-${day.getUTCMonth()}-${day.getUTCDate()}`;
|
|
1769
1771
|
const marker = markerByDayKey.get(markerKey);
|
|
1770
1772
|
const markerColor = marker?.color;
|
|
@@ -3126,12 +3128,7 @@ var TaskRow_default = TaskRow;
|
|
|
3126
3128
|
import { useMemo as useMemo3 } from "react";
|
|
3127
3129
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
3128
3130
|
var TodayIndicator = ({ monthStart, dayWidth, onHover, onHoverEnd }) => {
|
|
3129
|
-
const
|
|
3130
|
-
const todayLocal = new Date(Date.UTC(
|
|
3131
|
-
today.getFullYear(),
|
|
3132
|
-
today.getMonth(),
|
|
3133
|
-
today.getDate()
|
|
3134
|
-
));
|
|
3131
|
+
const todayLocal = getTodayLocalUtcDate();
|
|
3135
3132
|
const position = useMemo3(() => {
|
|
3136
3133
|
const offset = getDayOffset(todayLocal, monthStart);
|
|
3137
3134
|
return Math.round(offset * dayWidth);
|
|
@@ -9484,8 +9481,7 @@ function ResourceTimelineChart({
|
|
|
9484
9481
|
};
|
|
9485
9482
|
}, [collapsedResourceGroups, creatingResourceGroupType, layout, resourceAddRowHeight, resourceGrouping]);
|
|
9486
9483
|
const todayInRange = useMemo10(() => {
|
|
9487
|
-
const
|
|
9488
|
-
const today = new Date(Date.UTC(now.getFullYear(), now.getMonth(), now.getDate()));
|
|
9484
|
+
const today = getTodayLocalUtcDate();
|
|
9489
9485
|
return dateRange.some((day) => day.getTime() === today.getTime());
|
|
9490
9486
|
}, [dateRange]);
|
|
9491
9487
|
const itemsByResourceId = useMemo10(() => {
|
|
@@ -12157,8 +12153,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
12157
12153
|
return new Date(Date.UTC(firstDay.getUTCFullYear(), firstDay.getUTCMonth(), 1));
|
|
12158
12154
|
}, [dateRange]);
|
|
12159
12155
|
const todayIndex = useMemo13(() => {
|
|
12160
|
-
const
|
|
12161
|
-
const today = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
|
|
12156
|
+
const today = getTodayLocalUtcDate();
|
|
12162
12157
|
return dateRange.findIndex((day) => day.getTime() === today.getTime());
|
|
12163
12158
|
}, [dateRange]);
|
|
12164
12159
|
const todayInRange = todayIndex !== -1;
|
|
@@ -12178,8 +12173,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
12178
12173
|
if (hasAutoScrolledToTodayRef.current) return;
|
|
12179
12174
|
const container = scrollContainerRef.current;
|
|
12180
12175
|
if (!container || dateRange.length === 0) return;
|
|
12181
|
-
const
|
|
12182
|
-
const today = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
|
|
12176
|
+
const today = getTodayLocalUtcDate();
|
|
12183
12177
|
const todayIndex2 = dateRange.findIndex((day) => day.getTime() === today.getTime());
|
|
12184
12178
|
if (todayIndex2 === -1) return;
|
|
12185
12179
|
const todayOffset = todayIndex2 * dayWidth;
|
|
@@ -12248,8 +12242,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
12248
12242
|
if (isTableMatrixMode) return;
|
|
12249
12243
|
const container = scrollContainerRef.current;
|
|
12250
12244
|
if (!container || dateRange.length === 0) return;
|
|
12251
|
-
const
|
|
12252
|
-
const today = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
|
|
12245
|
+
const today = getTodayLocalUtcDate();
|
|
12253
12246
|
const todayIndex2 = dateRange.findIndex((day) => day.getTime() === today.getTime());
|
|
12254
12247
|
if (todayIndex2 === -1) return;
|
|
12255
12248
|
const todayOffset = todayIndex2 * dayWidth;
|
|
@@ -13231,6 +13224,7 @@ export {
|
|
|
13231
13224
|
getMultiMonthDays,
|
|
13232
13225
|
getSuccessorChain,
|
|
13233
13226
|
getTaskDuration,
|
|
13227
|
+
getTodayLocalUtcDate,
|
|
13234
13228
|
getTransitiveCascadeChain,
|
|
13235
13229
|
getVisibleReorderPlan,
|
|
13236
13230
|
getVisibleReorderPosition,
|