0
<FlatList
style={{backgroundColor: 'white', marginTop: 10}}
data={this.state.progr.data.sort((a, b) => a.start_time > b.start_time).filter(x => x.period === '2019-10-17T00:00:00.000-03:00')}
renderItem={({item}) => this.renderItem({item})}
keyExtractor = {(item, index) => item.id.toString()}
/>
The start_time being ordered gives me a JSON date, so 2019-09-10T14:00:00.000-03:00". I want to order by the hour.
I’ve tried it this way:
<FlatList
style={{backgroundColor: 'white', marginTop: 10}}
data={this.state.progr.data.sort((a, b) => a.(new Date(start_time).getHours()) > b.(new Date(start_time).getHours()).filter(x => x.period === '2019-10-17T00:00:00.000-03:00')}
renderItem={({item}) => this.renderItem({item})}
keyExtractor = {(item, index) => item.id.toString()}
/>
I tried it like this and it didn’t crt. Can someone help me with the syntax please?!
The filter is not being used to sort, it is being used to filter msm. Because JSON (q n was created by me) has one item for the date, one item for the initial hr, and one item for the final hr
– Ruan Duarte
If you notice in the above code, Sort is used with start_time and filter with period. They are distinct
– Ruan Duarte
I’m ordering the rendering, because the sheet has 4 flatList... all rendered with a different filter
– Ruan Duarte