Browse Source

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

gilberto.cancel 2 years ago
parent
commit
0d74bd5ed3
1 changed files with 21 additions and 23 deletions
  1. 21
    23
      screens/main/StateTime.js

+ 21
- 23
screens/main/StateTime.js View File

13
       this.endtime = 0,
13
       this.endtime = 0,
14
       this.timesetter = 0,
14
       this.timesetter = 0,
15
     this.state = {
15
     this.state = {
16
-      Appointment : this.props.route.params.Appointment_Date,
16
+      Appointment : this.props.route.params.Appointment,
17
       int2_id : this.props.route.params.int_id,
17
       int2_id : this.props.route.params.int_id,
18
       mapflag: this.props.route.params.mapflag,
18
       mapflag: this.props.route.params.mapflag,
19
-      Pin: this.props.route.params.Pin,
20
       i_token: this.props.route.params.I_Token,
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
     this.time_assignment = this.time_assignment.bind(this);
24
     this.time_assignment = this.time_assignment.bind(this);
25
   }
25
   }
26
 
26
 
124
     console.log("UToken is: ")
124
     console.log("UToken is: ")
125
     console.log(this.state.u_token)
125
     console.log(this.state.u_token)
126
     const user = firebase.auth().currentUser;
126
     const user = firebase.auth().currentUser;
127
-    const uid = user.uid;
127
+    const uid = user.uid
128
     const u_token = this.state.u_token;
128
     const u_token = this.state.u_token;
129
     const i_token = this.state.i_token;
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
     const _time_ = selectedTime;
134
     const _time_ = selectedTime;
135
     const i_id = this.state.int2_id;
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
     firebase.firestore()
139
     firebase.firestore()
144
     .collection('APPOINTMENTS')
140
     .collection('APPOINTMENTS')
145
     .add({ 
141
     .add({ 
163
   else{
159
   else{
164
     const user = firebase.auth().currentUser
160
     const user = firebase.auth().currentUser
165
     const uid = user.uid
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
     const date = this.state.Appointment
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
     console.log('Params: ')
170
     console.log('Params: ')
174
     console.log(this.props.route.params)
171
     console.log(this.props.route.params)
175
     firebase.firestore()
172
     firebase.firestore()
210
       </TouchableWithoutFeedback>
207
       </TouchableWithoutFeedback>
211
     );
208
     );
212
   }
209
   }
213
-}
210
+}
211
+