dont use python syntax in js
This commit is contained in:
@@ -52,28 +52,21 @@ const Renderer: React.FC = () => {
|
||||
const [processedEvents, setProcessedEvents] = useState<Event[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("hook call");
|
||||
|
||||
const eventSort = (a, b) => {
|
||||
let result = 0;
|
||||
|
||||
console.log(order);
|
||||
console.log(sort);
|
||||
|
||||
if (order === "ascending") {
|
||||
if (sort in ["start_time", "end_time"]) {
|
||||
if (["start_time", "end_time"].includes(sort)) {
|
||||
result = new Date(b[sort]).getTime() - new Date(a[sort]).getTime();
|
||||
} else if (sort === "id") {
|
||||
result = b[sort] - a[sort];
|
||||
}
|
||||
} else if (order === "descending") {
|
||||
if (sort in ["start_time", "end_time"]) {
|
||||
if (["start_time", "end_time"].includes(sort)) {
|
||||
result = new Date(a[sort]).getTime() - new Date(b[sort]).getTime();
|
||||
} else if (sort === "id") {
|
||||
result = a[sort] - b[sort];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
@@ -84,7 +77,6 @@ const Renderer: React.FC = () => {
|
||||
result = new Date(a.end_time).getTime() > Date.now();
|
||||
} else if (filter === "past") {
|
||||
result = new Date(a.end_time).getTime() < Date.now();
|
||||
console.log(`Past ${result}`);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -135,8 +127,8 @@ const Renderer: React.FC = () => {
|
||||
</select>
|
||||
Filter:
|
||||
<select name="" onChange={handleFilterChange}>
|
||||
<option value="upcoming">Upcoming</option>
|
||||
<option value="all">All</option>
|
||||
<option value="upcoming">Upcoming</option>
|
||||
<option value="past">Past</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user