You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import React, { useEffect, useState } from "react";
import { Chrono } from "react-chrono";
import moment from "moment";
import InputLabel from "@material-ui/core/InputLabel";
import FormControl from "@material-ui/core/FormControl";
import Select from "@material-ui/core/Select";
import { data } from "./data";
Above is the code when I select 3 months data the data shortens and works fine but after filtering the data to 3 months and then again selecting the data for 1 year the component gets stuck and is not clickable even though the extra data is visible.
Then again if I select 3 months i.e. filter it again the component works fine.
Why could this be happening ? Is this a bug or I am doing something wrong ?
PS:- 3 months data is an array of 5 objects and 1 year data is an array of 13 objects. Would appreciate the help. Thanks
The text was updated successfully, but these errors were encountered:
import React, { useEffect, useState } from "react";
import { Chrono } from "react-chrono";
import moment from "moment";
import InputLabel from "@material-ui/core/InputLabel";
import FormControl from "@material-ui/core/FormControl";
import Select from "@material-ui/core/Select";
import { data } from "./data";
const App = () => {
const [items, setItems] = useState([]);
const [dateValue, setDateValue] = useState("1 year Ago");
const filterDate = (data, startDate, endDate) => {
return data.filter((item) => {
const postedDate = new Date(item.postedDate || item.datetime);
return postedDate >= startDate && postedDate <= endDate;
});
};
const handleDateFilter = (e) => {
const selectedValue = e.target.value;
setDateValue(selectedValue);
};
useEffect(() => {
const now = new Date();
let startDate;
}, [data, dateValue]);
console.log(items);
return (
<>
Duration
<Select
native
value={dateValue}
onChange={handleDateFilter}
label="Duration"
inputProps={{
name: "duration",
id: "outlined-duration-native-simple",
}}
>
<option value={"3 Months Ago"}>3 Months Ago
<option value={"6 Months Ago"}>6 Months Ago
<option value={"1 year Ago"}>1 year Ago
<Chrono
items={items}
disableToolbar
allowDynamicUpdate
mode="HORIZONTAL"
cardHeight={100}
fontSizes={{
cardText: "13px",
title: "14px",
cardTitle: "14px",
}}
theme={{
primary: "#FF7272",
secondary: "white",
cardBgColor: "rgba(37, 147, 252, 0.11)",
cardForeColor: "black",
}}
useReadMore
/>
</>
);
};
export default App;
Above is the code when I select 3 months data the data shortens and works fine but after filtering the data to 3 months and then again selecting the data for 1 year the component gets stuck and is not clickable even though the extra data is visible.
Then again if I select 3 months i.e. filter it again the component works fine.
Why could this be happening ? Is this a bug or I am doing something wrong ?
PS:- 3 months data is an array of 5 objects and 1 year data is an array of 13 objects. Would appreciate the help. Thanks
The text was updated successfully, but these errors were encountered: