[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.
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.
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.
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.