fixed sorting by timestamp

This commit is contained in:
Spencer Flagg 2024-01-25 08:36:46 +01:00
parent 43038cc576
commit d74326aca2
3 changed files with 8 additions and 3 deletions

View file

@ -31,7 +31,8 @@
// Fetch actions for the current day from PocketBase
const today = new Date().toISOString().split('T')[0];
const result = await pb.collection('actions').getList<Action>(1, 50, {
filter: `timestamp >= '${today}'`
filter: `timestamp >= '${today}'`,
sort: 'timestamp'
});
// Assuming the items are in the 'items' property of the result

View file

@ -13,7 +13,9 @@ import { onMount } from 'svelte';
async function fetchAllActions() {
// Fetch all actions. Adjust as needed for date range or pagination
const result = await pb.collection('actions').getList(1, 1000);
const result = await pb.collection('actions').getList(1, 1000,{
sort: 'timestamp'
});
return result.items;
}

View file

@ -23,7 +23,9 @@
async function fetchAllActions() {
// Fetch all actions. Adjust as needed for date range or pagination
const result = await pb.collection('actions').getList(1, 1000);
const result = await pb.collection('actions').getList(1, 1000, {
sort: 'timestamp'
});
return result.items;
}