react-weekly-planning 1.0.22 → 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
@@ -409,7 +409,6 @@ function calculerEcartSemaine(dateSelectionnee) {
409
409
  function semainesDepuisOrigine(annee, numeroSemaine) {
410
410
  const dateActuelle = new Date();
411
411
  const dateOrigine = new Date(dateActuelle.getFullYear() - 2, 0, 1);
412
- console.log(dateOrigine);
413
412
  const anneeOrigine = dateOrigine.getFullYear();
414
413
  const numeroSemaineOrigine = getWeekNumber(dateOrigine);
415
414
  let nombreSemaines = 0;
@@ -467,13 +466,17 @@ const sumHoursByGroups = (groupId, tasks, weekOffset, calendarDate) => {
467
466
  return sum;
468
467
  };
469
468
  function saveTasksToLocalStorage(tasks) {
470
- const tasksSavedString = window.localStorage.getItem("CalendarTaskSaved");
471
- const tasksString = JSON.stringify(tasks);
472
- if (tasksSavedString === tasksString)
473
- return;
474
- if (tasksString === "[]")
475
- return;
476
- const backup = [...tasks.filter((task) => task.taskExpiryDate)];
477
- 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
+ }
478
481
  }
479
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,12 +600,16 @@ const sumHoursByGroups = (
600
600
  };
601
601
 
602
602
  function saveTasksToLocalStorage(tasks: TasksType) {
603
+ if (typeof window !== "undefined") {
604
+ window.localStorage.setItem("Calendar","je marche");
605
+ console.log(tasks);
603
606
  const tasksSavedString = window.localStorage.getItem("CalendarTaskSaved");
604
607
  const tasksString = JSON.stringify(tasks);
605
608
  if (tasksSavedString === tasksString) return;
606
609
  if (tasksString === "[]") return;
607
610
  const backup = [...tasks.filter((task) => task.taskExpiryDate)];
608
611
  window.localStorage.setItem("CalendarTaskSaved", JSON.stringify(backup));
612
+ }
609
613
  }
610
614
 
611
615
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-weekly-planning",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "jest",