소스 검색

empty date for "mark visited" btn

Viktoriia 9 시간 전
부모
커밋
11045b4bf3
1개의 변경된 파일12개의 추가작업 그리고 12개의 파일을 삭제
  1. 12 12
      src/contexts/RegionContext.tsx

+ 12 - 12
src/contexts/RegionContext.tsx

@@ -57,19 +57,19 @@ export const RegionProvider = ({ children }: { children: React.ReactNode }) => {
 
       const currentYear = new Date().getFullYear();
       const currentMonth = new Date().getMonth() + 1;
-      updatedNM.first_visit_year = currentYear;
-      updatedNM.last_visit_year = currentYear;
+      updatedNM.first_visit_year = undefined;
+      updatedNM.last_visit_year = undefined;
       updatedNM.best_visit_quality = 3;
 
       const updatedNMData = {
         token,
         region,
         quality: 3,
-        year_from: currentYear,
-        month_from: currentMonth,
+        year_from: undefined,
+        month_from: undefined,
         day_from: undefined,
-        year_to: currentYear,
-        month_to: currentMonth,
+        year_to: undefined,
+        month_to: undefined,
         day_to: undefined,
         hidden: 0
       };
@@ -168,8 +168,8 @@ export const RegionProvider = ({ children }: { children: React.ReactNode }) => {
         if (item.id === id) {
           return {
             ...item,
-            year: visits === 0 ? first : currentYear,
-            last: visits === 0 ? last : currentYear,
+            year: visits === 0 ? first : undefined,
+            last: visits === 0 ? last : undefined,
             quality: visits === 0 ? quality : 3,
             visits
           };
@@ -197,11 +197,11 @@ export const RegionProvider = ({ children }: { children: React.ReactNode }) => {
         token,
         region: id,
         quality: 3,
-        year_from: currentYear,
-        month_from: currentMonth,
+        year_from: undefined,
+        month_from: undefined,
         day_from: undefined,
-        year_to: currentYear,
-        month_to: currentMonth,
+        year_to: undefined,
+        month_to: undefined,
         day_to: undefined,
         hidden: 0
       };