Skip Navigation

[Resolved] Datepicker Filter

This thread is resolved. Here is a description of the problem and solution.

Problem:
The user would like to filter orders by the day. Display the orders for a selected day.

Solution:
Toolset stores the dates and times as a number, it is the timestamp of the date or time. It is the date/time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

The view's datepicker will provide the day, at 00:00:00, configure the filter to look for a value that is greater than the provided filter value(from URL param). We'll still need to look if the posts are lower than the next day(22/12/2022 00:00:00).
Unfortunately, this will need some custom code to calculate it. Please check this similar thread https://toolset.com/forums/topic/between-dates/#post-1537199

This support ticket is created 3 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by Puntorosso 3 years, 7 months ago.

Assisted by: Jamal.

Author
Posts
#2056221

For a booking site, I have added a date/time custom field (ex. 21/12/2022 14:30), assigned to WooCommerce orders.
Now I would need to list all orders in a view, for a selected day, set using a datepicker.

1) How do I filter the view without a submit button? The filtering should work as soon as the datepicker value has been changed.

2) How do I filter only the order for that day (ex. 21/12/2022), ignoring the custom field's time (ex. 14:30)?

#2056701

Hello and thank you for contacting the Toolset support.

Toolset stores the dates and times as a number, it is the timestamp of the date or time. It is the date/time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

The view's datepicker will provide the day, at 00:00:00, configure the filter to look for a value that is greater than the provided filter value(from URL param). We'll still need to look if the posts are lower than the next day(22/12/2022 00:00:00).
Unfortunately, this will need some custom code to calculate it. Please check this similar thread https://toolset.com/forums/topic/between-dates/#post-1537199

#2057173

The filter works, thanks.

Now I only need to solve point 1
1) How do I filter the view without a submit button? The filtering should work as soon as the datepicker value has been changed.

#2057699

Awesome!

AJAX can be configured at the view's level:
- If you are using the blocks editor, check this screenshot hidden link
- If you are using the legacy editor, check this screenshot hidden link

#2057753

This is again one of the time when I find myself not seeing the wood for the trees... 🙁

Thanks a lot for pointing that out.

Best