Skip Navigation

[Resolved] Searching dates older than 1970 (unix timestamp)

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

Problem:

The customer reported that he is trying to add a date range search filter in a view, but it is not working.

Solution:

Guided that in the search filter settings, the type of control should be "datepicker", compare value should be "number" and the comparison type should be "between", for this date range search filter to work.

Relevant Documentation:

n/a

This support ticket is created 2 years, 4 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: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by heinP 2 years, 3 months ago.

Assisted by: Waqar.

Author
Posts
#2253449

Tell us what you are trying to do?
I have a WWI website. I want to offer a date search, preferably of the "between" type.
I have created a test custom posttype for the purpose of testing the possibilities.

It does not work. I have tried several scenarios: datefield as a datefield, datefield as a string, searching as string, date or number. Searching between, greater than, ...

Dates older than 1970 are NEGATIVE numbers. Can Toolset handle them properly? The documentation states that they are positive numbers.

Is there any documentation that you are following?
yes: https://toolset.com/documentation/user-guides/views/date-filters/

Is there a similar example that we can see?
I can give you access to the site, and the testpage.

What is the link to your site?
not on published pages; I can give you access in private message.

#2254009

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

To troubleshoot this, I'll need to see exactly how this search filter is set up in the admin area.

Can you please share temporary admin login details, along with the link to the page where this search can be seen?

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.

regards,
Waqar

#2254691

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing the admin access.

I've made some changes to the search filter for the "testeventdate" field and the date range search is working now.

In the search filter settings, I've selected the type of control to "datepicker", compare value as "number" and the comparison type to "between".
( screenshot: hidden link )

The way Toolset's date type custom field works, it stores the selected date's UNIX timestamp value at 12 am that day, as a raw custom field value.

As long as you're importing the date type custom fields data in the same format, you'll be able to use the date filter/search in views, without any issue.

I hope this helps and please let me know if you have any follow-up questions.

#2254741

Not sure what i did wrong in my testing, but, hey, it works perfectly now.
I suspect I never tried the combination 'date-picker' and 'search as number'.
Thank you very much.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.