react-weekly-planning 1.0.45 → 1.0.46
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/README.md +116 -0
- package/dist/components/VirtualGroupRow.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/utils.js +136 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/utils.d.ts +44 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -369,6 +369,34 @@ to create an organization that truly reflects you.
|
|
|
369
369
|
console.log(offset); // Logs the week offset for the given date
|
|
370
370
|
```
|
|
371
371
|
|
|
372
|
+
### `updateOffsetWithDateCalendarForMonth`
|
|
373
|
+
|
|
374
|
+
- **Description**: Calculates the month offset from a given calendar date.
|
|
375
|
+
- **Parameters**:
|
|
376
|
+
- `calendarDate` (Date): The date to compare.
|
|
377
|
+
- `timeZone` (string, optional): The timezone to use.
|
|
378
|
+
- **Returns**: The calculated month offset.
|
|
379
|
+
|
|
380
|
+
**Example**:
|
|
381
|
+
```javascript
|
|
382
|
+
import { updateOffsetWithDateCalendarForMonth } from "react-weekly-planning";
|
|
383
|
+
const offset = updateOffsetWithDateCalendarForMonth(new Date());
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### `updateOffsetWithDateCalendarForDay`
|
|
387
|
+
|
|
388
|
+
- **Description**: Calculates the day offset from a given calendar date.
|
|
389
|
+
- **Parameters**:
|
|
390
|
+
- `calendarDate` (Date): The date to compare.
|
|
391
|
+
- `timeZone` (string, optional): The timezone to use.
|
|
392
|
+
- **Returns**: The calculated day offset.
|
|
393
|
+
|
|
394
|
+
**Example**:
|
|
395
|
+
```javascript
|
|
396
|
+
import { updateOffsetWithDateCalendarForDay } from "react-weekly-planning";
|
|
397
|
+
const offset = updateOffsetWithDateCalendarForDay(new Date());
|
|
398
|
+
```
|
|
399
|
+
|
|
372
400
|
### `millisecondsToHours`
|
|
373
401
|
|
|
374
402
|
- **Description**: Converts milliseconds to a formatted hour string.
|
|
@@ -417,6 +445,66 @@ to create an organization that truly reflects you.
|
|
|
417
445
|
console.log(diff); // Logs 0 if it's the current week
|
|
418
446
|
```
|
|
419
447
|
|
|
448
|
+
### `calculateDayDifference`
|
|
449
|
+
|
|
450
|
+
- **Description**: Calculates the absolute difference in days between a selected date and the current date (both normalized to midnight).
|
|
451
|
+
- **Parameters**:
|
|
452
|
+
- `dateSelectionnee` (Date): The date to compare.
|
|
453
|
+
- `timeZone` (string, optional): The timezone to use.
|
|
454
|
+
- **Returns**: The difference in days.
|
|
455
|
+
|
|
456
|
+
**Example**:
|
|
457
|
+
```javascript
|
|
458
|
+
import { calculateDayDifference } from "react-weekly-planning";
|
|
459
|
+
const diff = calculateDayDifference(new Date());
|
|
460
|
+
console.log(diff); // Logs the day difference
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### `calculateMonthDifference`
|
|
464
|
+
|
|
465
|
+
- **Description**: Calculates the difference in months between a selected date and the current date.
|
|
466
|
+
- **Parameters**:
|
|
467
|
+
- `dateSelectionnee` (Date): The date to compare.
|
|
468
|
+
- `timeZone` (string, optional): The timezone to use.
|
|
469
|
+
- **Returns**: The difference in months (e.g., 0, 1, -1...).
|
|
470
|
+
|
|
471
|
+
**Example**:
|
|
472
|
+
```javascript
|
|
473
|
+
import { calculateMonthDifference } from "react-weekly-planning";
|
|
474
|
+
const diff = calculateMonthDifference(new Date());
|
|
475
|
+
console.log(diff); // Logs the month difference
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
### `getMonthDay`
|
|
479
|
+
|
|
480
|
+
- **Description**: Returns an array containing the metadata for all days in a specified month, based on a month offset from the current date.
|
|
481
|
+
- **Parameters**:
|
|
482
|
+
- `monthOffset` (number): The number of months to offset from the current month (e.g., 0 for current, 1 for next).
|
|
483
|
+
- `timeZone` (string, optional): The timezone to use.
|
|
484
|
+
- **Returns**: An array of objects, where each object contains `day`, `dayMonth`, `dayYear`, and `dayOfTheMonth`.
|
|
485
|
+
|
|
486
|
+
**Example**:
|
|
487
|
+
```javascript
|
|
488
|
+
import { getMonthDay } from "react-weekly-planning";
|
|
489
|
+
const days = getMonthDay(0); // Current month
|
|
490
|
+
console.log(days); // Logs all days of the current month
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
### `getDayHourlyForMonth`
|
|
494
|
+
|
|
495
|
+
- **Description**: Returns an array of day objects (start and end timestamps) for every day in a specified month, based on a month offset.
|
|
496
|
+
- **Parameters**:
|
|
497
|
+
- `monthOffset` (number): The number of months to offset from the current month.
|
|
498
|
+
- `timeZone` (string, optional): The timezone to use.
|
|
499
|
+
- **Returns**: An array of objects containing `positionDay`, `day`, `start`, and `end`.
|
|
500
|
+
|
|
501
|
+
**Example**:
|
|
502
|
+
```javascript
|
|
503
|
+
import { getDayHourlyForMonth } from "react-weekly-planning";
|
|
504
|
+
const hours = getDayHourlyForMonth(0); // Current month
|
|
505
|
+
console.log(hours);
|
|
506
|
+
```
|
|
507
|
+
|
|
420
508
|
### `getUniqueId`
|
|
421
509
|
|
|
422
510
|
- **Description**: Generates a unique identifier (UUID v4).
|
|
@@ -500,4 +588,32 @@ to create an organization that truly reflects you.
|
|
|
500
588
|
};
|
|
501
589
|
```
|
|
502
590
|
|
|
591
|
+
### `useCalendarDateState`
|
|
592
|
+
|
|
593
|
+
- **Description**: A hook that calculates and manages the foundational date state for the calendar. It generates the necessary grid data (days of the week and hourly slots) based on a reference date and offset.
|
|
594
|
+
- **Parameters**:
|
|
595
|
+
- `date` (Date): The reference date to center the calendar on.
|
|
596
|
+
- `weekOffset` (number, optional): The week offset (e.g., 0 for current week, 7 for next week).
|
|
597
|
+
- `timeZone` (string, optional): The timezone context.
|
|
598
|
+
- **Returns**: An object containing:
|
|
599
|
+
- `weekDays`: An array of day metadata (day name, month, year, day of month).
|
|
600
|
+
- `dailyHours`: An array of hourly slot configurations for the grid.
|
|
601
|
+
|
|
602
|
+
**Example**:
|
|
603
|
+
```tsx
|
|
604
|
+
import { useCalendarDateState } from "react-weekly-planning";
|
|
605
|
+
|
|
606
|
+
const MyComponent = ({ date, weekOffset }) => {
|
|
607
|
+
const { weekDays, dailyHours } = useCalendarDateState(date, weekOffset);
|
|
608
|
+
|
|
609
|
+
return (
|
|
610
|
+
<div>
|
|
611
|
+
{weekDays.map(d => <span key={d.dayOfTheMonth}>{d.day}</span>)}
|
|
612
|
+
</div>
|
|
613
|
+
);
|
|
614
|
+
};
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
503
619
|
---
|
|
@@ -7,7 +7,7 @@ import TaskVirtual from "./TaskContainer/TaskVirtual";
|
|
|
7
7
|
import AddTask from "./AddTask";
|
|
8
8
|
import { getHash, getNewTaskForDropOrPaste, getUniqueId, updateOffsetWithDateCalendar, } from "../lib/utils";
|
|
9
9
|
import { groupTdStyle } from "../lib/slyles";
|
|
10
|
-
const VirtualGroupRow = ({ group, i, props, getTasks, isValidTask, addTask, deleteTask, getTask, dailyHours, hashScope, tasks,
|
|
10
|
+
const VirtualGroupRow = ({ group, i, props, getTasks, isValidTask, addTask, deleteTask, getTask, dailyHours, hashScope, tasks, }) => {
|
|
11
11
|
const ref = useRef(null);
|
|
12
12
|
const { entry, height } = useIntersectionObserver(ref, {
|
|
13
13
|
rootMargin: "600px",
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,6 @@ export * from './components/GroupContainer';
|
|
|
15
15
|
export * from './components/VirtualGroupRow';
|
|
16
16
|
export * from './components/VirtualGroupRowDay';
|
|
17
17
|
export * from './components/DayContainer';
|
|
18
|
-
export
|
|
18
|
+
export { default as useCalendarDateState } from './hooks/useCalendarDateState';
|
|
19
19
|
export * from './contexts/CalendarTaskContext';
|
|
20
20
|
export * from './hooks/useIntersectionObserver';
|
package/dist/lib/utils.js
CHANGED
|
@@ -52,6 +52,34 @@ export function getDayHourly(weekOffset, timeZone) {
|
|
|
52
52
|
}
|
|
53
53
|
return dailyHours;
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Get daily hours for all days of a specific month.
|
|
57
|
+
* @param monthOffset - The number of months to offset from current month.
|
|
58
|
+
* @param timeZone - The optional timezone.
|
|
59
|
+
* @returns An array of day objects containing start and end timestamps.
|
|
60
|
+
*/
|
|
61
|
+
export function getDayHourlyForMonth(monthOffset, timeZone) {
|
|
62
|
+
const dailyHours = [];
|
|
63
|
+
const currentDate = getCalendarDate(timeZone);
|
|
64
|
+
const targetDate = new Date(currentDate.getFullYear(), currentDate.getMonth() + monthOffset, 1);
|
|
65
|
+
const year = targetDate.getFullYear();
|
|
66
|
+
const month = targetDate.getMonth();
|
|
67
|
+
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
68
|
+
for (let i = 1; i <= daysInMonth; i++) {
|
|
69
|
+
const dayDate = new Date(year, month, i);
|
|
70
|
+
const dayStart = new Date(dayDate);
|
|
71
|
+
dayStart.setHours(1, 0, 0, 0);
|
|
72
|
+
const dayEnd = new Date(dayDate);
|
|
73
|
+
dayEnd.setHours(23, 59, 59, 99); // Adjusted for consistency
|
|
74
|
+
dailyHours.push({
|
|
75
|
+
positionDay: i - 1,
|
|
76
|
+
day: dayDate,
|
|
77
|
+
start: dayStart.getTime(),
|
|
78
|
+
end: dayEnd.getTime(),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return dailyHours;
|
|
82
|
+
}
|
|
55
83
|
// Convert milliseconds to a readable date format
|
|
56
84
|
export function millisecondsToDate(milliseconds) {
|
|
57
85
|
const date = new Date(milliseconds);
|
|
@@ -133,6 +161,46 @@ export function getWeekDays(jump, timeZone) {
|
|
|
133
161
|
}
|
|
134
162
|
return weekDays;
|
|
135
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Get days of a specific month with an offset.
|
|
166
|
+
* @param monthOffset - The number of months to offset from current month.
|
|
167
|
+
* @param timeZone - The optional timezone.
|
|
168
|
+
* @returns An array of day metadata for the target month.
|
|
169
|
+
*/
|
|
170
|
+
export function getMonthDay(monthOffset, timeZone) {
|
|
171
|
+
const days = ["Sun", "Mon", "Tues", "Wed", "Thur", "Frid", "Sat"];
|
|
172
|
+
const monthNames = [
|
|
173
|
+
"Jan",
|
|
174
|
+
"Feb",
|
|
175
|
+
"Mar",
|
|
176
|
+
"Apr",
|
|
177
|
+
"May",
|
|
178
|
+
"Jun",
|
|
179
|
+
"Jul",
|
|
180
|
+
"Aug",
|
|
181
|
+
"Sept",
|
|
182
|
+
"Oct",
|
|
183
|
+
"Nov",
|
|
184
|
+
"Dec",
|
|
185
|
+
];
|
|
186
|
+
const currentDate = getCalendarDate(timeZone);
|
|
187
|
+
// Focus on the first of the month targetted by monthOffset
|
|
188
|
+
const targetDate = new Date(currentDate.getFullYear(), currentDate.getMonth() + monthOffset, 1);
|
|
189
|
+
const year = targetDate.getFullYear();
|
|
190
|
+
const month = targetDate.getMonth();
|
|
191
|
+
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
192
|
+
let monthDays = [];
|
|
193
|
+
for (let d = 1; d <= daysInMonth; d++) {
|
|
194
|
+
const dayDate = new Date(year, month, d);
|
|
195
|
+
monthDays.push({
|
|
196
|
+
day: days[dayDate.getDay()],
|
|
197
|
+
dayMonth: monthNames[dayDate.getMonth()],
|
|
198
|
+
dayYear: dayDate.getFullYear(),
|
|
199
|
+
dayOfTheMonth: dayDate.getDate(),
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return monthDays;
|
|
203
|
+
}
|
|
136
204
|
// The remaining functions follow the same structure. Ensure all comments are in English and make the functions exportable as required.
|
|
137
205
|
/**
|
|
138
206
|
* Get the ISO week number for a given date.
|
|
@@ -180,6 +248,32 @@ export function calculateWeekDifference(dateSelectionnee, timeZone) {
|
|
|
180
248
|
const ecartJours = Math.round((dimancheSelected - dimancheActuelle) / MS_PAR_JOUR);
|
|
181
249
|
return ecartJours; // Retournera 0, 7, -7, 14, -14...
|
|
182
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Calculate the day difference between the selected date and the current date.
|
|
253
|
+
* @param dateSelectionnee - The selected date.
|
|
254
|
+
* @param timeZone - The optional timezone.
|
|
255
|
+
* @returns The difference in days.
|
|
256
|
+
*/
|
|
257
|
+
export function calculateDayDifference(dateSelectionnee, timeZone) {
|
|
258
|
+
const dateActuelle = getCalendarDate(timeZone);
|
|
259
|
+
const utcSelected = Date.UTC(typeof dateSelectionnee === "string" ? new Date(dateSelectionnee).getFullYear() : dateSelectionnee.getFullYear(), typeof dateSelectionnee === "string" ? new Date(dateSelectionnee).getMonth() : dateSelectionnee.getMonth(), typeof dateSelectionnee === "string" ? new Date(dateSelectionnee).getDate() : dateSelectionnee.getDate());
|
|
260
|
+
const utcActuelle = Date.UTC(dateActuelle.getFullYear(), dateActuelle.getMonth(), dateActuelle.getDate());
|
|
261
|
+
const MS_PAR_JOUR = 86400000;
|
|
262
|
+
return Math.round((utcSelected - utcActuelle) / MS_PAR_JOUR);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Calculate the month difference between the selected date and the current date.
|
|
266
|
+
* @param dateSelectionnee - The selected date.
|
|
267
|
+
* @param timeZone - The optional timezone.
|
|
268
|
+
* @returns The difference in months.
|
|
269
|
+
*/
|
|
270
|
+
export function calculateMonthDifference(dateSelectionnee, timeZone) {
|
|
271
|
+
const dateActuelle = getCalendarDate(timeZone);
|
|
272
|
+
const selectedDate = typeof dateSelectionnee === "string" ? new Date(dateSelectionnee) : dateSelectionnee;
|
|
273
|
+
const yearDiff = selectedDate.getFullYear() - dateActuelle.getFullYear();
|
|
274
|
+
const monthDiff = selectedDate.getMonth() - dateActuelle.getMonth();
|
|
275
|
+
return yearDiff * 12 + monthDiff;
|
|
276
|
+
}
|
|
183
277
|
/**
|
|
184
278
|
* Calculate the number of weeks since an arbitrary origin date (January 1, 2022).
|
|
185
279
|
* @param annee - The year.
|
|
@@ -228,6 +322,14 @@ export function compareWeekOffset(calendarDate, weekOffset, taskDate, timeZone)
|
|
|
228
322
|
const ecartTask = calculateWeekDifference(taskDate, timeZone);
|
|
229
323
|
return weekOffset === ecartTask;
|
|
230
324
|
}
|
|
325
|
+
export function compareMonthOffset(monthOffset, taskDate, timeZone) {
|
|
326
|
+
const ecartTask = calculateMonthDifference(taskDate, timeZone);
|
|
327
|
+
return monthOffset === ecartTask;
|
|
328
|
+
}
|
|
329
|
+
export function compareDayOffset(dayOffset, taskDate, timeZone) {
|
|
330
|
+
const ecartTask = calculateDayDifference(taskDate, timeZone);
|
|
331
|
+
return dayOffset === ecartTask;
|
|
332
|
+
}
|
|
231
333
|
export const sumHoursByGroups = (groupId, tasks, weekOffset, calendarDate, timeZone) => {
|
|
232
334
|
let sum = 0;
|
|
233
335
|
if (tasks)
|
|
@@ -239,6 +341,28 @@ export const sumHoursByGroups = (groupId, tasks, weekOffset, calendarDate, timeZ
|
|
|
239
341
|
});
|
|
240
342
|
return sum;
|
|
241
343
|
};
|
|
344
|
+
export const sumHoursByGroupsForMonth = (groupId, tasks, monthOffset, timeZone) => {
|
|
345
|
+
let sum = 0;
|
|
346
|
+
if (tasks)
|
|
347
|
+
tasks.forEach((task) => {
|
|
348
|
+
if (task.groupId === groupId &&
|
|
349
|
+
compareMonthOffset(monthOffset, task.taskDate, timeZone) === true) {
|
|
350
|
+
sum += task.taskEnd - task.taskStart;
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
return sum;
|
|
354
|
+
};
|
|
355
|
+
export const sumHoursByGroupsForDay = (groupId, tasks, dayOffset, timeZone) => {
|
|
356
|
+
let sum = 0;
|
|
357
|
+
if (tasks)
|
|
358
|
+
tasks.forEach((task) => {
|
|
359
|
+
if (task.groupId === groupId &&
|
|
360
|
+
compareDayOffset(dayOffset, task.taskDate, timeZone) === true) {
|
|
361
|
+
sum += task.taskEnd - task.taskStart;
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
return sum;
|
|
365
|
+
};
|
|
242
366
|
export function saveTasksToLocalStorage(tasks) {
|
|
243
367
|
if (typeof window !== "undefined") {
|
|
244
368
|
window.localStorage.setItem("Calendar", "je marche");
|
|
@@ -272,6 +396,18 @@ export const updateOffsetWithDateCalendar = (calendarDate, timeZone) => {
|
|
|
272
396
|
}
|
|
273
397
|
return calculateWeekDifference(calendarDate, timeZone);
|
|
274
398
|
};
|
|
399
|
+
export const updateOffsetWithDateCalendarForMonth = (calendarDate, timeZone) => {
|
|
400
|
+
if (typeof calendarDate === 'string') {
|
|
401
|
+
return calculateMonthDifference(new Date(calendarDate), timeZone);
|
|
402
|
+
}
|
|
403
|
+
return calculateMonthDifference(calendarDate, timeZone);
|
|
404
|
+
};
|
|
405
|
+
export const updateOffsetWithDateCalendarForDay = (calendarDate, timeZone) => {
|
|
406
|
+
if (typeof calendarDate === 'string') {
|
|
407
|
+
return calculateDayDifference(new Date(calendarDate), timeZone);
|
|
408
|
+
}
|
|
409
|
+
return calculateDayDifference(calendarDate, timeZone);
|
|
410
|
+
};
|
|
275
411
|
export const millisecondsToHours = (milliseconds) => {
|
|
276
412
|
return millisecondsToDate(milliseconds).formattedDate;
|
|
277
413
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ export * from './components/GroupContainer';
|
|
|
12
12
|
export * from './components/VirtualGroupRow';
|
|
13
13
|
export * from './components/VirtualGroupRowDay';
|
|
14
14
|
export * from './components/DayContainer';
|
|
15
|
-
export
|
|
15
|
+
export { default as useCalendarDateState } from './hooks/useCalendarDateState';
|
|
16
16
|
export * from './contexts/CalendarTaskContext';
|
|
17
17
|
export * from './hooks/useIntersectionObserver';
|
|
@@ -9,6 +9,18 @@ export declare function getDayHourly(weekOffset: number, timeZone?: TimeZone): {
|
|
|
9
9
|
start: number;
|
|
10
10
|
end: number;
|
|
11
11
|
}[];
|
|
12
|
+
/**
|
|
13
|
+
* Get daily hours for all days of a specific month.
|
|
14
|
+
* @param monthOffset - The number of months to offset from current month.
|
|
15
|
+
* @param timeZone - The optional timezone.
|
|
16
|
+
* @returns An array of day objects containing start and end timestamps.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getDayHourlyForMonth(monthOffset: number, timeZone?: TimeZone): {
|
|
19
|
+
positionDay: number;
|
|
20
|
+
day: Date;
|
|
21
|
+
start: number;
|
|
22
|
+
end: number;
|
|
23
|
+
}[];
|
|
12
24
|
export declare function millisecondsToDate(milliseconds: number): {
|
|
13
25
|
formattedDate: string;
|
|
14
26
|
dayOfWeek: string;
|
|
@@ -23,12 +35,38 @@ export declare function getWeekDays(jump: number, timeZone?: TimeZone): {
|
|
|
23
35
|
dayYear: number;
|
|
24
36
|
dayOfTheMonth: number;
|
|
25
37
|
}[];
|
|
38
|
+
/**
|
|
39
|
+
* Get days of a specific month with an offset.
|
|
40
|
+
* @param monthOffset - The number of months to offset from current month.
|
|
41
|
+
* @param timeZone - The optional timezone.
|
|
42
|
+
* @returns An array of day metadata for the target month.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getMonthDay(monthOffset: number, timeZone?: TimeZone): {
|
|
45
|
+
day: string;
|
|
46
|
+
dayMonth: string;
|
|
47
|
+
dayYear: number;
|
|
48
|
+
dayOfTheMonth: number;
|
|
49
|
+
}[];
|
|
26
50
|
/**
|
|
27
51
|
* Calculate the week difference between the selected date and the current date.
|
|
28
52
|
* @param dateSelectionnee - The selected date.
|
|
29
53
|
* @returns The week difference in days.
|
|
30
54
|
*/
|
|
31
55
|
export declare function calculateWeekDifference(dateSelectionnee: Date, timeZone?: TimeZone): number;
|
|
56
|
+
/**
|
|
57
|
+
* Calculate the day difference between the selected date and the current date.
|
|
58
|
+
* @param dateSelectionnee - The selected date.
|
|
59
|
+
* @param timeZone - The optional timezone.
|
|
60
|
+
* @returns The difference in days.
|
|
61
|
+
*/
|
|
62
|
+
export declare function calculateDayDifference(dateSelectionnee: Date, timeZone?: TimeZone): number;
|
|
63
|
+
/**
|
|
64
|
+
* Calculate the month difference between the selected date and the current date.
|
|
65
|
+
* @param dateSelectionnee - The selected date.
|
|
66
|
+
* @param timeZone - The optional timezone.
|
|
67
|
+
* @returns The difference in months.
|
|
68
|
+
*/
|
|
69
|
+
export declare function calculateMonthDifference(dateSelectionnee: Date, timeZone?: TimeZone): number;
|
|
32
70
|
/**
|
|
33
71
|
* Calculate the number of weeks since an arbitrary origin date (January 1, 2022).
|
|
34
72
|
* @param annee - The year.
|
|
@@ -42,10 +80,16 @@ export declare function getNewTaskForDropOrPaste(positionDay: number, dropGroupI
|
|
|
42
80
|
newTask: any;
|
|
43
81
|
} | undefined;
|
|
44
82
|
export declare function compareWeekOffset(calendarDate: Date, weekOffset: number, taskDate: Date, timeZone?: TimeZone): boolean;
|
|
83
|
+
export declare function compareMonthOffset(monthOffset: number, taskDate: Date, timeZone?: TimeZone): boolean;
|
|
84
|
+
export declare function compareDayOffset(dayOffset: number, taskDate: Date, timeZone?: TimeZone): boolean;
|
|
45
85
|
export declare const sumHoursByGroups: (groupId: string, tasks: TasksType | any, weekOffset: number, calendarDate: Date, timeZone?: TimeZone) => number;
|
|
86
|
+
export declare const sumHoursByGroupsForMonth: (groupId: string, tasks: TasksType | any, monthOffset: number, timeZone?: TimeZone) => number;
|
|
87
|
+
export declare const sumHoursByGroupsForDay: (groupId: string, tasks: TasksType | any, dayOffset: number, timeZone?: TimeZone) => number;
|
|
46
88
|
export declare function saveTasksToLocalStorage(tasks: TasksType): void;
|
|
47
89
|
export declare const updateCalendarDateWithOffset: (offset: number, timeZone?: TimeZone) => Date;
|
|
48
90
|
export declare const updateOffsetWithDateCalendar: (calendarDate: Date, timeZone?: TimeZone) => number;
|
|
91
|
+
export declare const updateOffsetWithDateCalendarForMonth: (calendarDate: Date, timeZone?: TimeZone) => number;
|
|
92
|
+
export declare const updateOffsetWithDateCalendarForDay: (calendarDate: Date, timeZone?: TimeZone) => number;
|
|
49
93
|
export declare const millisecondsToHours: (milliseconds: number) => string;
|
|
50
94
|
export declare const checkDuplicates: (tasks: TasksType, taskStart: number, taskEnd: number, groupId: string) => boolean;
|
|
51
95
|
export declare const getSavedTasks: () => any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-weekly-planning",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/types/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -67,6 +67,10 @@
|
|
|
67
67
|
"./hooks/useIntersectionObserver": {
|
|
68
68
|
"types": "./dist/types/hooks/useIntersectionObserver.d.ts",
|
|
69
69
|
"default": "./dist/hooks/useIntersectionObserver.js"
|
|
70
|
+
},
|
|
71
|
+
"./hooks/useCalendarDateState": {
|
|
72
|
+
"types": "./dist/types/hooks/useCalendarDateState.d.ts",
|
|
73
|
+
"default": "./dist/hooks/useCalendarDatState.js"
|
|
70
74
|
}
|
|
71
75
|
},
|
|
72
76
|
"files": [
|