Selaa lähdekoodia

Arregle el error de la fecha no ser la que el usuario escoge en el calendario

gilberto.cancel 2 vuotta sitten
vanhempi
commit
0d74bd5ed3
1 muutettua tiedostoa jossa 21 lisäystä ja 23 poistoa
  1. 21
    23
      screens/main/StateTime.js

+ 21
- 23
screens/main/StateTime.js Näytä tiedosto

@@ -13,14 +13,14 @@ export default class Time extends Component{
13 13
       this.endtime = 0,
14 14
       this.timesetter = 0,
15 15
     this.state = {
16
-      Appointment : this.props.route.params.Appointment_Date,
16
+      Appointment : this.props.route.params.Appointment,
17 17
       int2_id : this.props.route.params.int_id,
18 18
       mapflag: this.props.route.params.mapflag,
19
-      Pin: this.props.route.params.Pin,
20 19
       i_token: this.props.route.params.I_Token,
21
-      u_token: this.props.route.params.U_Token
20
+      u_token: this.props.route.params.U_Token,
21
+      pin: this.props.route.params.Pin
22 22
     }
23
-    console.log(this.props.route.params)
23
+    console.log(" Time params: ",this.props.route.params)
24 24
     this.time_assignment = this.time_assignment.bind(this);
25 25
   }
26 26
 
@@ -124,22 +124,18 @@ export default class Time extends Component{
124 124
     console.log("UToken is: ")
125 125
     console.log(this.state.u_token)
126 126
     const user = firebase.auth().currentUser;
127
-    const uid = user.uid;
127
+    const uid = user.uid
128 128
     const u_token = this.state.u_token;
129 129
     const i_token = this.state.i_token;
130
-    const date = moment(this.state.Appointment);
131
-    console.log("date: ", date)
132
-    const month = date.month();
133
-    const day = date.date();
130
+    const date = this.state.Appointment
131
+    const month = date.getMonth() + 1;
132
+    console.log("Month: ", month)
133
+    const day = date.getDate();
134 134
     const _time_ = selectedTime;
135 135
     const i_id = this.state.int2_id;
136
-    const pin = this.state.Pin;
137
-    const lat = pin.latitude; 
138
-    const lon = pin.longitude;
139
-    console.log('Params: ')
140
-    console.log(this.props.route.params)
141
-    console.log("lat is: ")
142
-    console.log(lat)
136
+    const lat = this.state.pin.latitude; 
137
+    const lon = this.state.pin.longitude;
138
+  
143 139
     firebase.firestore()
144 140
     .collection('APPOINTMENTS')
145 141
     .add({ 
@@ -163,13 +159,14 @@ export default class Time extends Component{
163 159
   else{
164 160
     const user = firebase.auth().currentUser
165 161
     const uid = user.uid
166
-    const u_token = user.push_token
167
-    const i_token = this.state.i_token
162
+    const u_token = this.state.u_token;
163
+    const i_token = this.state.i_token;
168 164
     const date = this.state.Appointment
169
-    const month = date.month()
170
-    const day = date.date()
171
-    const _time_ = selectedTime
172
-    const i_id = this.state.int2_id
165
+    const month = date.getMonth();
166
+    const day = date.getDate();
167
+    console.log("Date: ", day)
168
+    const _time_ = selectedTime;
169
+    const i_id = this.state.int2_id;
173 170
     console.log('Params: ')
174 171
     console.log(this.props.route.params)
175 172
     firebase.firestore()
@@ -210,4 +207,5 @@ export default class Time extends Component{
210 207
       </TouchableWithoutFeedback>
211 208
     );
212 209
   }
213
-}
210
+}
211
+