tengo datos json por fechas que quiero mostrar el tiempo de programación para hoy. ¿Cómo se puede implementar esto? dirección del archivo json https://volnaveri.by/tt.json
reaccionar código nativo
import React, { Component } from 'react'; import { ActivityIndicator, FlatList, Text, View } from 'react-native'; export default class App extends Component { constructor(props) { super(props); this.state = { data: [], isLoading: true }; } async getMovies() { try { const response = await fetch('https://volnaveri.by/tt.json'); const json = await response.json(); this.setState({ data: json.times }); } catch (error) { console.log(error); } finally { this.setState({ isLoading: false }); } } componentDidMount() { this.getMovies(); } render() { const { data, isLoading } = this.state; return ( <View style={{ flex: 1, padding: 24 }}> {isLoading ? <ActivityIndicator/> : ( <FlatList data={data} keyExtractor={({ id }, index) => id} renderItem={({ item }) => ( <Text>{item.Date}, {item.Monday}, {item.Tuesday}, {item.Monday}, {item.Wednesday}, {item.Thursday}</Text> )} /> )} </View> ); } };En lugar de this.setState({datos: json.times});
Que hacer:
this.setState({ datos: [data.times.find(time => time.Date.split('-')[2] === new Date().getDate()))]