Filter for date and time fields by "in this week"
Feature description
Currently, Baserow date type fields can be filtered by: "is today," "in this month," "in this year," etc. There's one helpful time period which is missing, which is: "in this week."
Great for weekly Kanban boards that teams could use.
Background
Tables/Views
Baserow allows users to create tables of data (think spreadsheet/relation database hybrid) and then create different views over the tables filtering/sorting by specific fields (columns). Baserow currently supports 4 different view types to show the data in a database table in different ways: Grid, Form, Gallery and Kanban. Grid/Gallery and Kanban views can have filters applied to restrict the rows/cards shown.
If a new view filter works in the Grid view then it will also work on a Kanban/Gallery view. So there is no need to test filters using anything but the normal Grid view.
View Filters
In Baserow there are many different view filter types which let you filter views by a specific field. For example you can create a contains {some_filter_value}
view filter on a text field
which will filter down the view to only show rows whose text field
value contains {some_filter_value}
.
View Filters Have realtime frontend "pre-checks"
When a user is editing a rows value, we want to quickly show if their modifications will result in the row being hidden by an existing filter. For example if a text field is filtered by contains 'my filter value'
and a user edits an existing row whose text field value was my filter value
to not matching
there will be an real-time display of a yellow warning showing that if the edit is saved that row will then disappear.
For performance and UX reasons this check is done entirely in the frontend in the ViewFilterType.matches
method.
To manually test this behaviour with a new view filter you can:
- create a filter of the new type which matches a row
- double click on the rows cell and edit it's value so it no longer matches the filter you made
- Now if your
YourViewFilterTypeName.matches
implementation is correctly working then you should see the yellow warning bar before you save the row indicating the row no longer matches the active filters
The Issue
We want to introduce a new view filter type that allows users to filter on a date field to only show rows where the date is in the current week.
Pointers
- The filter must be compatible with the
date
,last modified
andcreated on
field types because they're all date columns in the db. - It should work with the real time check of the value in the front-end described in the section above.
- It must be clear in the automatically generated docs (https://baserow.io/api-docs) what JSON is expected when programmatically creating a filter of this new type:
- We value high quality and clearly documented code.
- There should be good tests for the backend and for the web-frontend.
Information
- More information about how to setup your development environment can be found here https://baserow.io/docs/development%2Fdevelopment-environment
- More information about how view filters work can be found here https://baserow.io/docs/plugins%2Fview-filter-type