This has probably been asked before, but I thought some clarification might be needed for others who will hit these issues.
I feel the following code should obey the order following it. Servoy should make assumptions about a method that attempts an automated find.
currentcontroller.find();
var today = new Date();
var searchDate = utils.dateFormat(today, 'MM-dd-yyyy')
forms.mag_subs.subs_renewdate = searchDate;
currentcontroller.search();
-
If the field being searched on the form has a format assigned to it, and is a displayType CALENDAR, (such as MM/dd/yyyy) then the field should require/obey that format.
-
If the field being searched on the form has no format assigned then it should default to the setting in Preferences > Locale
Date Format
- We should be able to use a function like getLocaleDateFormat() found under the Application object so we can coerce dates in functions like utils.dateFormat() -This addition would anticipate localization issues that should be added for international versions of Servoy front ends. Using a table to determine time zone offsets and comparing against a local clock should allow the adjustment of date formatting.
P.S. Yes, I found this post Finding/searching on dates - Classic Servoy - Servoy Community but I think formatting on date fields should have overrides for searching. I do know that the code above has to be formatted as such in order to work…
currentcontroller.find();
var today = new Date();
var searchDate = utils.dateFormat(today, 'MM-dd-yyyy')
forms.mag_subs.subs_renewdate = searchDate + '|MM-dd-yyyy';
currentcontroller.search();