Skip to content

Commit

Permalink
set date filter to this month by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume_Bernier committed May 21, 2024
1 parent f9cc544 commit f671561
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
($filterValues.type && $filterValues.type.length > 0) ||
($filterValues.date && $filterValues.date.start && $filterValues.date.end);
if (!$filterValues.date) {
$filterValues.date = { start: undefined, end: undefined };
}
</script>

<div class="flex items-center justify-between">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
} from './index.js';
/* Default import */
import { DataTableCheckbox } from '../index.js';
import {
getLocalTimeZone,
today,
startOfMonth,
endOfMonth,
} from '@internationalized/date';
let now = today(getLocalTimeZone());
import * as Table from '$lib/components/ui/table';
Expand Down Expand Up @@ -142,7 +150,7 @@
}
return true;
},
initialFilterValue: { start: undefined, end: undefined },
initialFilterValue: { start: startOfMonth(now), end: endOfMonth(now) },
render: ({ filterValue }) => get(filterValue)
}
}
Expand Down

0 comments on commit f671561

Please sign in to comment.