react-weekly-planning 1.0.23 → 1.0.24

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/lib/utils.js CHANGED
@@ -466,15 +466,17 @@ const sumHoursByGroups = (groupId, tasks, weekOffset, calendarDate) => {
466
466
  return sum;
467
467
  };
468
468
  function saveTasksToLocalStorage(tasks) {
469
- if (!window)
470
- return;
471
- const tasksSavedString = window.localStorage.getItem("CalendarTaskSaved");
472
- const tasksString = JSON.stringify(tasks);
473
- if (tasksSavedString === tasksString)
474
- return;
475
- if (tasksString === "[]")
476
- return;
477
- const backup = [...tasks.filter((task) => task.taskExpiryDate)];
478
- window.localStorage.setItem("CalendarTaskSaved", JSON.stringify(backup));
469
+ if (typeof window !== "undefined") {
470
+ window.localStorage.setItem("Calendar", "je marche");
471
+ console.log(tasks);
472
+ const tasksSavedString = window.localStorage.getItem("CalendarTaskSaved");
473
+ const tasksString = JSON.stringify(tasks);
474
+ if (tasksSavedString === tasksString)
475
+ return;
476
+ if (tasksString === "[]")
477
+ return;
478
+ const backup = [...tasks.filter((task) => task.taskExpiryDate)];
479
+ window.localStorage.setItem("CalendarTaskSaved", JSON.stringify(backup));
480
+ }
479
481
  }
480
482
  export { getWeeksListUpdate, saveTasksToLocalStorage, clickedDate, getCalandarDays, startDateMilliseconds, endDateMilliseconds, getDayHourly, millisecondsToDate, getWeekDays, formatDateToCustomFormat, displayDayOnModalLeft, millisecondsToInt, getWeekMonthAndYear, getWeeksList, getDoubleWeeksList, calculerEcartSemaine, calculateTimeOfDayRange, getSessionStorageRecordForDragAndDrop, compareWeekOffset, sumHoursByGroups, };
package/lib/utils.ts CHANGED
@@ -600,13 +600,16 @@ const sumHoursByGroups = (
600
600
  };
601
601
 
602
602
  function saveTasksToLocalStorage(tasks: TasksType) {
603
- if (!window) return;
603
+ if (typeof window !== "undefined") {
604
+ window.localStorage.setItem("Calendar","je marche");
605
+ console.log(tasks);
604
606
  const tasksSavedString = window.localStorage.getItem("CalendarTaskSaved");
605
607
  const tasksString = JSON.stringify(tasks);
606
608
  if (tasksSavedString === tasksString) return;
607
609
  if (tasksString === "[]") return;
608
610
  const backup = [...tasks.filter((task) => task.taskExpiryDate)];
609
611
  window.localStorage.setItem("CalendarTaskSaved", JSON.stringify(backup));
612
+ }
610
613
  }
611
614
 
612
615
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-weekly-planning",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "jest",