@@ -30,18 +30,30 @@ class ShowPage extends React.Component {
3030 addEventToCalendar ( ) {
3131 RNCalendarEvents . findCalendars ( ) . then ( response => {
3232 let calendarId = response [ 0 ] . id ;
33- RNCalendarEvents . saveEvent ( this . props . name , {
33+ RNCalendarEvents . saveEvent ( this . props . place . name , {
3434 calendarId : calendarId ,
35- startDate : parseDate ( this . props . date_time . start ) ,
36- endDate : parseDate ( this . props . date_time . end )
35+ startDate : this . parseDate ( this . props . place . date_time . start ) ,
36+ endDate : this . parseDate ( this . props . place . date_time . end )
3737 } ) ;
3838 } ) ;
3939 }
4040
4141 parseDate ( time ) {
4242 // '2018-04-29T19:26:00.000Z'
4343 // '2018-04-29T20:26:00.000Z'
44- return "${this.props.date}T${time}.000Z" ;
44+ let months = [ "January" , "February" , "March" , "April" , "May" , "June" , "July" , "August" , "September" , "October" , "November" , "December" ] ;
45+ let dates = this . props . place . date . split ( "-" ) ;
46+
47+ let month = months [ dates [ 1 ] . slice ( 1 , 2 ) - 1 ] ;
48+ let day = dates [ 2 ] ;
49+ let year = dates [ 0 ] ;
50+
51+ // "July 21, 1983 01:15:00"
52+
53+ let date = new Date ( `${ month } ${ day } , ${ year } ${ time } ` ) ;
54+ let utc = date . toISOString ( ) ;
55+
56+ return utc ;
4557 }
4658
4759 submit ( ) {
@@ -116,17 +128,17 @@ class ShowPage extends React.Component {
116128 />
117129 < View style = { styles . info } >
118130 < Text style = { styles . title } > { place . name } </ Text >
119- < View style = { { width : 70 } } >
120- < StarRating
131+ { place . rating
132+ && < View style = { { width : 70 } } >
133+ < StarRating
121134 disabled = { false }
122135 maxStars = { 5 }
123136 disabled = { true }
124137 starSize = { 20 }
125138 style = { { width : 70 } }
126139 rating = { place . rating }
127140 fullStarColor = { '#FE5D26' }
128- />
129- </ View >
141+ /> </ View > }
130142 { place . formatted_address
131143 && < Text style = { styles . body } > { place . formatted_address } </ Text > }
132144 { place . formatted_phone_number
0 commit comments